フィルターのクリア

How can I save multiple plots to separate image files with variable file name?

4 ビュー (過去 30 日間)
Hi, I want to know how I can put the variable file name for saving multiple plots to image files. For example, for 1394x1040 size image, if I create a plot of intensity for every row of pixels and save evey plot to separate image files, I have to use variables in image file name.
Thank you so much for the help.
  1 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2018 年 10 月 6 日
編集済み: KALYAN ACHARJYA 2018 年 10 月 6 日
Plot intensity vs col num (as the row is fixed), clarify?

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

採用された回答

Stephen23
Stephen23 2018 年 10 月 7 日
編集済み: Stephen23 2018 年 10 月 7 日
"...if I create a plot of intensity for every row of pixels and save evey plot to separate image files, I have to use variables in image file name."
Yes, you will have to use variables in the filename. And that is easy with sprintf, something like this:
im = your 1394x1040 image
for k = 1:size(im,1)
row = im(k,:);
... process and plot of each row
fnm = sprintf('Plot %d.png',k);
saveas(gcf,fnm)
end
  1 件のコメント
Jungkeuk Park
Jungkeuk Park 2018 年 10 月 9 日
Thank you, Stephen.
Creating filename with sprintf was the answer.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by