How can I save a figure (in jpeg and pdf) from this code?
3 ビュー (過去 30 日間)
古いコメントを表示
Display a geographic globe in a figure created using the uifigure function.
uif = uifigure;
g = geoglobe(uif);
0 件のコメント
回答 (1 件)
DGM
2024 年 9 月 13 日
編集済み: DGM
2024 年 9 月 14 日
At least as of R2019b, saveas() and print() do not accept uifigure handles. The documentation suggests that's still the case, but my network connection is too crappy to open MATLAB online to verify that.
Documentation suggests that exportgraphics() should accept uifigure handles, but again, I cannot test that. It should support PDF outputs as well. Depending on what you're doing, maybe exportapp() is appropriate.
As always, using JPG for anything is usually a completely bad idea. For synthetic graphics with hard edges and flat coloring, JPG will produce a visually conspicuous degradation of image quality, and the file size will typically be larger than a PNG. Unless you understand what compromises come with a 70% 4:2:0 JPG, don't use JPG.
2 件のコメント
DGM
2024 年 9 月 14 日
Is that documented anywhere? Webdocs doesn't mention uifigure, and the closest relevant notes in RN is about removing support for UI elements in an undisclosed future release. From R2022b and R2023b:
These functions and menu items will no longer support printing or exporting UI components in a future release:
• The print function
• The saveas function
So they're going to remove support for saving uifigures containing buttons and stuff using these tools -- but as far as I know, they don't support uifigures anyway. What am I missing?
I'd test this, but again, I can't even get MATLAB online to load.
参考
カテゴリ
Help Center および File Exchange で Audio and Video Data についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!