How do I create a dynamic file name when printing to jpeg?

2 ビュー (過去 30 日間)
Matt Brown
Matt Brown 2018 年 1 月 19 日
コメント済み: Matt Brown 2018 年 1 月 22 日
I have a function which generates the same plot for multiple data sets. My goal is to save each plot under a unique filename. It looks something like this:
figure1=figure('visible', 'off')
axes1=axes('Parent',figure1)
plot(x,y)
print -djpeg test.jpeg
fclose(figure1)
This will overwrite the same jpeg each time. What I would like to have is test01.jpg, test02.jpg and so on corresponding to the string identifying each data set (i.e. test01, test02). I have tried dropping the string into the print command, but to no avail.
print -djpeg horzcat(idstring,'.jpeg')

採用された回答

Walter Roberson
Walter Roberson 2018 年 1 月 19 日
print('-djpeg', [idstring,'.jpeg'])
  1 件のコメント
Matt Brown
Matt Brown 2018 年 1 月 22 日
Wonderful. Thank you sir!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGuidance, Navigation, and Control (GNC) についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by