GUIDE GUI’s in MATLAB are really just a series of function calls triggered by callbacks associated with different uicontrols. Because these are all sub-functions, it can be difficult to get into the sub-function at the right time to see the variables that are in scope. This technique allows you do debug a GUI without putting in conditional break points in your code.
By
Doug Hull
Doug first used MATLAB in 1994, could not figure it out until he got some help in 1995. He is now dedicated to making sure that no one else wastes a year of their life not knowing MATLAB like he did.
I think it’s easier to get the handles of the GUI-figure, by return the handles like this:
handleGUI = myGUIfunction(params);
and then you can call the handles-structure with the command
handles = guidata(handleGUI);
I used to define exclusively the properties of my GUI, so I can find it later.
For example, I set the ‘Tag’ or the ‘Name’ of the GUI with a special pattern like ‘This is the GUI that I want to find’, so I can do later:
handleGUI = findobj(0, 'Tag','This is the GUI that I want to find')
and again:
handles = guidata(handleGUI);
And my preferred solution is (when I defined exclusively my GUI-figure) to create a “Shortcut” which finds the GUI-handle and load the current handles-scructure in to the workspace.
In this case you should remember that this method will get the actual state of the GUI, so if you change any value in the GUI, you must get the handles structure again.
I think it’s easier to get the handles of the GUI-figure, by return the handles like this:
and then you can call the handles-structure with the command
I used to define exclusively the properties of my GUI, so I can find it later.
For example, I set the ‘Tag’ or the ‘Name’ of the GUI with a special pattern like ‘This is the GUI that I want to find’, so I can do later:
and again:
And my preferred solution is (when I defined exclusively my GUI-figure) to create a “Shortcut” which finds the GUI-handle and load the current handles-scructure in to the workspace.
In this case you should remember that this method will get the actual state of the GUI, so if you change any value in the GUI, you must get the handles structure again.
J.R.
I like your method too. There might be problems if your handle visibility is set to ‘off’ or ‘callback’, but findall will cure that.
Doug