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일

1 개 추천

>> 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개)

KSSV
KSSV 2018년 8월 10일

0 개 추천

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.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Data Type Identification에 대해 자세히 알아보기

제품

릴리스

R2018a

태그

질문:

2018년 8월 10일

댓글:

2018년 8월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by