How to reopen a same figure with different buttons in Matlab App designer

2 views (last 30 days)
Hello,
In the app I am working on, I am trying to achieve the following functionality -
As can be seen in the picture, there are 4 buttons. button 1 (PLOT) plots 2 graphs in UIAxes(in the app). Button 2&3 (open in new Window) open the graphs individually in new figure windows and button 4(EXPORT) saves this plots to a desired folder.
Currently, I am plotting in UIAxes, then I am plotting a new graph in a new window, then I am plotting a new graph in new window to export it.
But it is not a nice solution.
So, is there any way I can store the figure (maybe as a property) in the app and can recall when different buttons (2,3,4) were pressed?
I am trying to get the figure or its handles (as an output) from the function I run when button 1 is pushed, and then store it as a property in the app, then call this figure when button 2,3,4 are pushed. I am getting the handle, but not being able to reconstruct the figure after that.
Have a nice day.

Accepted Answer

Walter Roberson
Walter Roberson on 22 Aug 2022
You can store handles to figures as "properties" of your app, or you can store them as UserData properties of any of a number of kinds of objects.
However the handles would have to be to figures that currently exist. You might possibly switch the figure between visible and not.
Otherwise you would have to use the callbacks to openfig()... though at the moment I am not sure what the support is for openfig and app designer

More Answers (0)

Categories

Find more on Migrate GUIDE Apps 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!