필터 지우기
필터 지우기

How to know if exist an field into a struct?

조회 수: 4 (최근 30일)
jon
jon 2016년 4월 14일
댓글: jon 2016년 4월 14일
I want a funtion which give me "0" if dosen't exist a field into a struct and "1" if it exist, something like that:
s=struct("field1",val1,"field2",val2,"field3",val3);
exist(s.field1)
=1
exist(s.field5)
=0

채택된 답변

Steven Lord
Steven Lord 2016년 4월 14일
Take a look at isfield.

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by