cannot setappdata to GUIHandles

2 ビュー (過去 30 日間)
William
William 2013 年 1 月 21 日
Matlab wiki claims this exists but I cannot set or save anything to GUIHandle I tried GUIHANDLES and that didn't work either. DOes anyone know what handles are the best to pass variables in and out of functions? I don't want to use global variables
Here is what I tried below
Thanks
% Do this to save variables to your figure's workspace.
% handles.GUIHandle is the "Tag" property of your main GUI figure.
% Double-click figure to bring up the "Property Inspector" in GUIDE.
setappdata(handles.GUIHandle, 'yourVariable', yourVariable)
% Do this to retrieve variables from your figure's workspace.
yourVariable = getappdata(handles.GUIHandle , 'yourVariable')
% Do this to remove what you saved from your figure's workspace.
rmappdata(handles.GUIHandle, 'yourVariable')

採用された回答

Walter Roberson
Walter Roberson 2013 年 1 月 21 日
At the place that GUIHandle appears, you need to use the same name as you set for the Tag property of your figure.
Like the comment says above, "Double-click figure to bring up the "Property Inspector" in GUIDE." You can set the Tag property from there.
  2 件のコメント
Image Analyst
Image Analyst 2013 年 1 月 22 日
編集済み: Image Analyst 2013 年 1 月 22 日
For what it's worth, I always call the tag for my main GUI "figMainWindow". So it's always the same and I never have to try to remember what I called a particular one. If my main GUI calls other subordinate, helper GUIs, then I give them a slightly different name, like figSettings or something. I also expanded the explanation in the FAQ to try to make it more clear what you have to do.
William
William 2013 年 1 月 28 日
An excellent Idea thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by