フィルターのクリア

How to save all the images generated from the for loop?

4 ビュー (過去 30 日間)
Sateesh Kandukuri
Sateesh Kandukuri 2022 年 10 月 14 日
編集済み: Sateesh Kandukuri 2022 年 10 月 14 日
for i=1:length(fileList)
a=importdata(fileList(i).name);
avec=a;
avec(:,1:3)=[];
proj(:,1)=avec(:,1)
proj(:,2)=avec(:,2)
proj(:,3)=avec(:,3)
projx=reshape(proj(:,1),[250,150]);
projy=reshape(proj(:,2),[250,150]);
projz=reshape(proj(:,3),[250,150]);
projxnew=projx.';
projynew=projy.';
projznew=projz.';
subplot(1,3,1);
imagesc(xlimits,ylimits,projxnew,climx);
pbaspect([2.5 1.5 1])
xlim(xlimits);
ylim(ylimits);
subplot(1,3,2);
imagesc(xlimits,ylimits,projynew,climy);
pbaspect([2.5 1.5 1])
xlim(xlimits);
ylim(ylimits);
subplot(1,3,3);
imagesc(xlimits,ylimits,projznew,climz);
pbaspect([2.5 1.5 1])
xlim(xlimits);
ylim(ylimits);
f=figure;
f = strcat(num2str(i),'.png');
saveas(gcf,f);
end
  2 件のコメント
KSSV
KSSV 2022 年 10 月 14 日
What is the problem with the present code?
Sateesh Kandukuri
Sateesh Kandukuri 2022 年 10 月 14 日
Hi, I am unable to save all the figures directly.

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

採用された回答

Jan
Jan 2022 年 10 月 14 日
Remove the line
f=figure;
at the bottom of the loop, but open a new figure on top:
for i=1:length(fileList)
FigH = =figure;
... your code
FileName = strcat(num2str(i),'.png');
saveas(FigH, FileName);
delete(FigH);
end
  1 件のコメント
Sateesh Kandukuri
Sateesh Kandukuri 2022 年 10 月 14 日
Thank you so much Jan. It's working.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrinting and Saving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by