how to save plots ".pdf" in a folder generated by mkdir function?

4 ビュー (過去 30 日間)
Saeedullah Mandokhail
Saeedullah Mandokhail 2016 年 2 月 2 日
I want save my plots in a folder created by mkdir. I am to plot from multiple excel files and save with the excel file name in a folder name as Newfolder. The code generates folder "Newfolder" but save the plots in Parent folder, not in Newfolder. How can I change my code to save the plots in Newfolder. my code looks like this.
mkdir('Newfolder'); saveas(gcf, [basename '.pdf']);

採用された回答

Walter Roberson
Walter Roberson 2016 年 2 月 2 日
outputdir = 'NewFolder';
if ~exist(outputdir, 'dir')
mkdir(outputdir);
end
saveas(gcf, fullfile(outputdir, [basename '.pdf'])
  1 件のコメント
Saeedullah Mandokhail
Saeedullah Mandokhail 2016 年 2 月 4 日
my problem is solved. Thanks a lot Walter Roberson.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by