- Replace 'app.UIFigure' with the handle to the specific UI figure to be saved.
- Replace 'filename.png' with the desired output file name and format.
App designer : Saveas save all the interface and not just the figure mentionned
3 views (last 30 days)
Show older comments
Hello,
I made an interface with add designer where I display different graphs. I would like to save these graphs separately.
So I used saveas(app.Power_loss,fullfile(fname,'Simulation of PEMFC'),'fig'); where app.Power_loss is the name of UIAxes.
The first problem is that I can't use the png format but only the fig format.
The second is that it saves the entire interface. Moreover, it only takes into account the graphs comprising a single curve. I can't understand why the saveas command behaves like this. Do you have an idea?

0 Comments
Answers (2)
Saurabh
on 18 Jun 2025
Hi Bastien,
Based on the description, it appears that the goal is to save graphs generated within the app separately using the 'saveas' function. Upon investigation and testing, a similar issue was observed where the output did not match expectations.
As a potential workaround, the 'exportgraphics' function is recommended for this use case. This function provides more reliable and high-quality output when exporting UI figures or components.
The syntax for using this function is:
exportgraphics(app.Uifigurename, filename.png);
In this command:
For more information about this function, refer to the following official MathWorks documentation: https://www.mathworks.com/help/matlab/creating_plots/saving-your-work.html
I hope this was helpful!
0 Comments
Benjamin Kraus
on 18 Jun 2025
Edited: Benjamin Kraus
on 18 Jun 2025
The saveas command is designed to save an entire figure to a special file-format (.fig) so that it can be opened again in MATLAB. That is why the file format is restricted to just ".fig".
If you want to export your graphics to an image format for viewing outside MATLAB, you should use the exportgraphics command.
0 Comments
See Also
Categories
Find more on Creating, Deleting, and Querying Graphics Objects 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!