- 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 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Saurabh
2025년 6월 18일
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
Benjamin Kraus
2025년 6월 18일
편집: Benjamin Kraus
2025년 6월 18일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!