Access handles structure in a GUI
2 次查看(过去 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 中查找有关 Debugging and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!