フィルターのクリア

isa not recognizing Line or Figure class

2 ビュー (過去 30 日間)
Mikael Agopov
Mikael Agopov 2018 年 8 月 10 日
コメント済み: KSSV 2018 年 8 月 10 日
I wanted to test whether input data of a function is a Line object using something like:
>>
x=-2*pi:.01:2*pi;HLine=plot(sin(2*x));
However, now isa(HLine,'Line') returns false! So far, isa has faithfully recognized my self-made classes. Why doesn't it recognize Line?

採用された回答

Guillaume
Guillaume 2018 年 8 月 10 日
>> x=-2*pi:.01:2*pi;HLine=plot(sin(2*x));
>> class(HLine)
ans =
'matlab.graphics.chart.primitive.Line'
>> isa(HLine, 'matlab.graphics.chart.primitive.Line')
ans =
logical
1
You need to use the fully qualified name of the class
  1 件のコメント
Mikael Agopov
Mikael Agopov 2018 年 8 月 10 日
Thank you, that explains it.

サインインしてコメントする。

その他の回答 (1 件)

KSSV
KSSV 2018 年 8 月 10 日
x=-2*pi:.01:2*pi;
HLine=plot(sin(2*x));
strcmp(HLine.Type,'line')
  2 件のコメント
Guillaume
Guillaume 2018 年 8 月 10 日
Note that the Type property of a graphics object is not relevant for isa.
KSSV
KSSV 2018 年 8 月 10 日
Yes....thats why I used strcmp to check is it a Line type.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

タグ

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by