フィルターのクリア

I want to write figures generated during the execution of my program into a folder. I could write into two folders in the order figure1, figure2 etc.. but to other folders

1 回表示 (過去 30 日間)
I want to write figures generated during the execution of my program into a folder. I could write into two folders in the order figure1, figure2 etc.. but to other folders, I think the last figure overwrite the previous figures and also by default the figure is numbered as figure512, which I had not given..maybe because of the same name other files are overwritten and I get only the last figure generated...please help me to solve this problem..
  3 件のコメント
RENJI
RENJI 2023 年 9 月 20 日
for i= 1:total_images
figure(i), imshow(I1)
saveas(figure(i),fullfile("C:\Users\Matlab\Grayscale",['figure' num2str(i) '.jpg']));
close(figure)
end
Mathieu NOE
Mathieu NOE 2023 年 9 月 21 日
編集済み: Mathieu NOE 2023 年 9 月 21 日
this code will save all figures in the same directory , as for me this code is fine
I have no problem like you of figures / files being overwritten
now I am unsure abut your folders question so I wonder if you want to store one (or several ) figures in separate folders
for example , if you would like to store one image in one dedicated subfolder, you could do this :
note that here I don't create a new figure each time which can slow down your code and fill your screen
for i= 1:total_images
% figure(i), imshow(I1)
f = figure(1), imshow(I1)
% create a new folder
newFolder = ['newFolder' num2str(i)];
mkdir(pwd,newFolder); % create subfolder where I want to store 1 figure
saveas(f,fullfile(newFolder,['figure' num2str(i) '.jpg']));
close(figure)
end

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by