Effacer les filtres
Effacer les filtres

Why does ISFIELD always return FALSE when querying a user-defined class in MATLAB 7.7 (R2008b)?

14 vues (au cours des 30 derniers jours)
When I use the function ISFIELD on a MATLAB class object, it always returns false, even when I know that the queried property is there.
The class definition includes a property called 'myproperty'
classdef myclass
properties
myproperty = 0;
end
end
When I check the presence of a property as follows:
x=myclass
isfield(x,'myproperty')
ISFIELD always returns a FALSE
ans =
0

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 27 Juin 2009
Using ISFIELD on a user defined MATLAB class is not supported in MATLAB 7.7 (R2008b).
As a workaround, use the following to determine if a property exists for a class:
any(strcmp(properties(x), 'myproperty'))

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Produits


Version

R2008b

Community Treasure Hunt

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

Start Hunting!

Translated by