Effacer les filtres
Effacer les filtres

isa not recognizing Line or Figure class

2 vues (au cours des 30 derniers jours)
Mikael Agopov
Mikael Agopov le 10 Août 2018
Commenté : KSSV le 10 Août 2018
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?

Réponse acceptée

Guillaume
Guillaume le 10 Août 2018
>> 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 commentaire
Mikael Agopov
Mikael Agopov le 10 Août 2018
Thank you, that explains it.

Connectez-vous pour commenter.

Plus de réponses (1)

KSSV
KSSV le 10 Août 2018
x=-2*pi:.01:2*pi;
HLine=plot(sin(2*x));
strcmp(HLine.Type,'line')
  2 commentaires
Guillaume
Guillaume le 10 Août 2018
Note that the Type property of a graphics object is not relevant for isa.
KSSV
KSSV le 10 Août 2018
Yes....thats why I used strcmp to check is it a Line type.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Type Identification dans Help Center et File Exchange

Tags

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by