saveas(gcf​,save_name​+".png")をフ​ォルダを指定して保存

saveas(gcf,save_name+".png");を決まったフォルダに保存するためにはどのようにすればよろしいでしょうか。

 Accepted Answer

saveasの第2引数に「フォルダー名\」 (Windowsの場合)、「フォルダー名/」(LinuxとMacの場合)を入れるか、fullfileでフォルダー名入りのパスを作ればできます。
例えば現在のフォルダーの中にあるresultというフォルダーに入れたい場合、
saveas(gcf, fullfile("result", save_name+".png"));
または
saveas(gcf, "result\" + save_name+".png");
でできます。
フルパスを指定することもできます。
saveas(gcf, "C:\Result\" + save_name+".png");

1 Comment

晃平
晃平 on 8 Feb 2024
ご回答ありがとうございました。

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Release

R2021a

Tags

Asked:

on 21 Jul 2023

Commented:

on 8 Feb 2024

Community Treasure Hunt

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

Start Hunting!