Borrar filtros
Borrar filtros

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

14 visualizaciones (últimos 30 días)
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

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 27 de Jun. de 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'))

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Productos


Versión

R2008b

Community Treasure Hunt

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

Start Hunting!

Translated by