UI Figure/UI Axesを保存したり、画像としてエクスポートするにはどうすればよいですか?
26 views (last 30 days)
Show older comments
MathWorks Support Team
on 1 Nov 2017
Edited: MathWorks Support Team
on 29 Jul 2021
App Designer などで作成した UI Figure / UI Axes の保存したり、エクスポートする方法を教えてください。
Accepted Answer
MathWorks Support Team
on 29 Jul 2021
Edited: MathWorks Support Team
on 29 Jul 2021
R2020a 以降では、exportgraphics 関数や copygraphics 関数を使用して、UIFigure や UIAxes を直接画像などに保存することができます。
・exportgraphics
・copygraphics
また、R2020b より、exportapp 関数を使用して、UIFigure をエクスポートすることが可能です。
・exportapp
R2019b 以前のリリースをご利用の場合は、以下の内容を参考にしてください。
UI Figure および UI Axes は、従来の figure や axes がサポートしていた機能の一部のみサポートしており、印刷、保存、コールバックの実行、マウスまたはキーボードの対話型の操作はサポートしていません。
解決策としては、以下のように UI Figure/UI Axes を従来の figure/axes にコピーしてから保存する方法が考えられます。
ux = uiaxes;
p = plot(ux,magic(5));
fig1 = figure;
ax = axes;
copyobj(ux.Children,ax);
savefig( fig1,'fig1'); % fig ファイルとして保存
saveas(fig1, 'myplot.png'); % PNG ファイルとして保存
0 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!