I want to save all periods of time series as a png

In MATLAB, figures are displayed correctly on the screen, but when they are saved as PNG files, the right part of the figure is cropped. Why does this happen, and how can it be resolved?

6 件のコメント

Angelo Yeo
Angelo Yeo 2026 年 1 月 29 日
移動済み: Angelo Yeo 2026 年 1 月 29 日
Would you try exportgraphics instead of print?
재혁
재혁 2026 年 1 月 29 日
移動済み: Angelo Yeo 2026 年 1 月 29 日
I tried print as you can see a screen shot what I attatched
재혁
재혁 2026 年 1 月 29 日
移動済み: Angelo Yeo 2026 年 1 月 29 日
And I also tried exportgraphics too, but it is not diffrent
Image Analyst
Image Analyst 2026 年 1 月 29 日
移動済み: Angelo Yeo 2026 年 1 月 29 日
OK but follow her suggestion and use exportgraphics instead.
Angelo Yeo
Angelo Yeo 2026 年 1 月 29 日
移動済み: Angelo Yeo 2026 年 1 月 29 日
@재혁, thanks for trying out. Would you please give us a snippet of code and some toy dataset so that people can reproduce your issue? Also, giving out your environment (OS, MATLAB version...) can be helpful.
재혁
재혁 2026 年 1 月 29 日
移動済み: Angelo Yeo 2026 年 1 月 29 日
I attatched my mat and script code. My environment is apple Mac OS and matlab version is 2025b

サインインしてコメントする。

 採用された回答

Angelo Yeo
Angelo Yeo 2026 年 1 月 29 日
移動済み: Angelo Yeo 2026 年 1 月 29 日

0 投票

Well, I only have a Windows 11 machine, and it's not reproducible. It might be an issue specific to Mac only. What about another workaround like below to use imwrite?
gf = getframe(gcf);
imwrite(gf.cdata,'temp.png');

1 件のコメント

재혁
재혁 2026 年 1 月 29 日
移動済み: Angelo Yeo 2026 年 1 月 29 日
Oh! using imwrite works perfectly!! I'll use that as a workaround for now. Thank you for your suggestion!!.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

製品

リリース

R2025b

タグ

質問済み:

2026 年 1 月 29 日

移動済み:

2026 年 1 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by