Creating two figures in your guide
Show older comments
Answers (1)
Walter Roberson
on 16 Feb 2021
0 votes
Technically Yes, but in practice... not so nice.
GUIDE cannot be used to build two simultaneous interfaces: you cannot directly split an interface across two windows. You cannot, for example, use it to (directly) create a file selection interface, and have it control a separate figure that has plotting controls.
It is possible to program a callback in one GUIDE GUI to call an external function that just happens to be a second, separately manged, GUIDE GUI. However, sharing data and control between the two is a bit tricky, and control and your code is likely to get confused if you happen to have the same object 'tag' in two different interfaces. It is possible to specifically restrict a search to a particular object to one particular figure, but a lot of the time that does not get programmed in.
The "obvious" approach to want to take would be to store data in the handles structure, invoke the second GUIDE gui, and have it pull the needed information from the handles structure. However, it turns out that each GUIDE GUI has its own handles structure, that are not shared between GUIs, making it necessary to take the time to deliberately coordinate between them. It is possible (I have done it), but you have to know what you are doing.
Instead of trying to coordinate between two different GUIDE GUIs, it is possible to use GUIDE to lay out the main GUI, and then to have code that calls appropriate functions to create a second figure and populates it with controls and configures its callbacks. But you have to be careful: when I said earlier that handles structure is not shared between GUIs, what I was really saying is that handles structure is not shared between figures, so callbacks for controls on the second figure do not get the same handles structure as callbacks for the first GUI. You can work around-these things, but you have to be conscious of what you are doing.
It is not uncommon that by the time you are comfortable deliberately coordinating the action between multiple live figures, that you just give up and go ahead and build the GUIs entirely in code without using GUIDE (at least not for anything more than "storyboarding" to see how the various graphics elements look next to each other.)
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!