フィルターのクリア

saving images onto a folder

24 ビュー (過去 30 日間)
shru s
shru s 2017 年 6 月 12 日
コメント済み: Image Analyst 2020 年 3 月 28 日
hello, i have images being generated after every loop and i want to store them all in one folder only. but with the saveas option, the images get overrriden to those already in the folder. do you guys know how i can fix this? thank you. i am using the following code right now:
h = findobj('type','figure');
n = length(h);
for k=1:n
saveas(figure(k),fullfile('C:\Users\Desktop\project\A data\SegmentedCharWithBlanks',['figure' num2str(k) '.jpg']));
end
  7 件のコメント
shru s
shru s 2017 年 6 月 12 日
The same program is generating a number of images per loop and im trying to save them all together. I did try to use the largest number to index but havent been successful yet. Ill try it again.Thank you so much for taking the time to look into my issue. I am grateful
shru s
shru s 2017 年 6 月 12 日
編集済み: shru s 2017 年 6 月 12 日
got it!

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

採用された回答

Image Analyst
Image Analyst 2017 年 6 月 12 日
Use sprintf() to create the filename. It can be unique for each iteration of your loop. Then use imwrite() if you want to save images. For example:
baseFileName = sprintf('Image #%d.png', k);
fullFileName = fullfile(folder, baseFileName);
imwrite(yourImage, fullFileName);
Use saveas() or save() (instead of imwrite) if you want to save figures - basically screenshots of the axes with tickmarks, labels, title, legends, stuff in the graphical overlay above the image like lines and text, etc.
  2 件のコメント
shru s
shru s 2017 年 6 月 12 日
Thank you so much for always helping me out!
Fawad Chandio
Fawad Chandio 2019 年 9 月 3 日
fullFileName means which file...??
baseFileName .....??

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

その他の回答 (1 件)

Malayappan Shridhar
Malayappan Shridhar 2020 年 3 月 28 日
I wish to write a binary image imbin to a folder with the name shown below.
WriteFileName = "C:\ISI-Kappa\FromWorkBin\Front_1\b_180311788230057_Front.jpg"
My command is imwrite(imbin, WriteFileName)
I get this error: Error using imwrite>parse_inputs (line 523)
A filename must be supplied.
I appreciate any help to resolve this error
  1 件のコメント
Image Analyst
Image Analyst 2020 年 3 月 28 日
Are you sure that folder already exists because I'm not sure imwrite() will create folders automatically, though it might. You also might try using forward slashes. What does this say:
whos imbin
Is it a uint8 image?

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

カテゴリ

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