How can I save/export a UI Figure/UI Axes?

조회 수: 293 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2017년 1월 18일
편집: MathWorks Support Team 2021년 7월 12일
I would like to know how to save and export a UI Figure/UI Axes.

채택된 답변

MathWorks Support Team
MathWorks Support Team 2021년 7월 12일
편집: MathWorks Support Team 2021년 7월 12일
In R2020a and later releases, you can export and copy UIFIgure  and UI Axes directly.
exportgraphics
copygraphics
From R2020b, you use exportapp function when exporting UIFigure.
If you use R2019b and earlier releases, please refer the following information.
UI Figures and  UI Axes support only a subset of the properties that traditional figures and axes support. UI Figures and UI Axes do not support properties for printing, saving, callback execution, or custom mouse and keyboard interaction.
One workaround to save the UI Figures/UI Axes is to copy it to a traditional figure/axes and then save it.
ux = uiaxes;
p = plot(ux,magic(5));
fig1 = figure;
ax = axes;
copyobj(ux.Children,ax);
saveas( fig1,'myplot.png');
Another workaround is to use 'ScreenCapture', a File Exchange pick of the week: https://www.mathworks.com/matlabcentral/fileexchange/24323-screencapture-get-a-screen-capture-of-a-figure-frame-or-component
A blog post about this function can be found here: https://blogs.mathworks.com/pick/2012/08/10/grab-a-screen-shot-from-within-matlab/
Please note that if you have any questions regarding the code in a File Exchange, please contact the author.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by