필터 지우기
필터 지우기

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

조회 수: 14 (최근 30일)
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

채택된 답변

MathWorks Support Team
MathWorks Support Team 2009년 6월 27일
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'))

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

제품


릴리스

R2008b

Community Treasure Hunt

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

Start Hunting!

Translated by