check if a variable in a structure exist

Hello, I must check if the variable handles.Y2 exists in the structure handles(I work with gui). Using exist gives me 0 although it exist in the structure thanks

 채택된 답변

dpb
dpb 2014년 4월 16일

12 개 추천

isfield(handles,'Y2')
doc isfield % for details
help struct % for reminder on structures

추가 답변 (1개)

Sara
Sara 2014년 4월 16일

1 개 추천

Use:
ispresent = isfield(handles,'Y2')
See
help isfield
for more infos.

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

질문:

2014년 4월 16일

댓글:

2014년 4월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by