Azzera filtri
Azzera filtri

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

14 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 27 Giu 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'))

Più risposte (0)

Categorie

Scopri di più su Structures in Help Center e File Exchange

Prodotti


Release

R2008b

Community Treasure Hunt

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

Start Hunting!

Translated by