How can I save multiple figures with partly same variable name?

I want to save many figures in one script with partly the same name. Therefore I want to define a variable in the beginning and then have this part in the saving name of all figures with slightly different ending. For example:
name=('picture')
figure %1
surf(peaks)
savefig('Peaks' name '.fig') %Peakspicture.fig
figure %2
scatter(peaks)
savefig('scatterbla' picture '.fig') %scatterblapicture.fig

 採用された回答

Stephen23
Stephen23 2017 年 3 月 5 日
編集済み: Stephen23 2017 年 3 月 5 日

0 投票

Use sprintf:
name = 'Picture';
fnm = sprintf('Peaks_%s.fig',name);
savefig(fnm,...)
fnm = sprintf('scatterbla_%s.fig',name);
savefig(fnm,...)

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

質問済み:

2017 年 3 月 5 日

編集済み:

2017 年 3 月 5 日

Community Treasure Hunt

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

Start Hunting!

Translated by