check if a variable in a structure exist

214 views (last 30 days)
Alon
Alon on 16 Apr 2014
Commented: Alon on 16 Apr 2014
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

Accepted Answer

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

More Answers (1)

Sara
Sara on 16 Apr 2014
Use:
ispresent = isfield(handles,'Y2')
See
help isfield
for more infos.

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!