Access handles structure in a GUI
1 回表示 (過去 30 日間)
古いコメントを表示
I am programming a GUI and am storing a lot of variables in the handles structure. Sometimes I just want to have a look on one of these variables. So I would like to create a button that just gets the handles structure, lets me to look at it in the workspace, make changes if I want, and then returns to the usual program.
Any idea how I could do that?
0 件のコメント
採用された回答
Image Analyst
2014 年 1 月 8 日
If you stop at a breakpoint you can edit things in the variable editor - just double click on the handles name you see in the workspace. Or you can do it in the command window:
>> handles.yourVariable = someNewValue;
If you want to display all the fields in a listbox or somewhere then you can use the fieldnames function.
3 件のコメント
Image Analyst
2014 年 1 月 8 日
dbstop may do it. But maybe you want to display the fields in a listbox and ask your user which one she wants to edit. Then you accept the new value and you do it in the callback code:
% 1) Ask what field
% 2) Ask what new value they want
% 3) Assign new value to the field
handles.whatever = someNewValue;
return;
If your users don't have access to the MATLAB development environment with the ability to set break points, I don't know that you want them to just randomly go changing your handles variables whenever they want. Doesn't sound like good programming practice to me. There are better ways of having the user change setting, like controls such as scroll bars, checkboxes, edit boxes, etc.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!