check if a variable in a structure exist

76 ビュー (過去 30 日間)
Alon
Alon 2014 年 4 月 16 日
コメント済み: Alon 2014 年 4 月 16 日
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 日
isfield(handles,'Y2')
doc isfield % for details
help struct % for reminder on structures

その他の回答 (1 件)

Sara
Sara 2014 年 4 月 16 日
Use:
ispresent = isfield(handles,'Y2')
See
help isfield
for more infos.
  1 件のコメント
Alon
Alon 2014 年 4 月 16 日
thank u too!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by