How to save images using for loop?
1 回表示 (過去 30 日間)
古いコメントを表示
Nisreen Sulayman
2014 年 9 月 18 日
コメント済み: Nisreen Sulayman
2014 年 9 月 18 日
I have an error using imwrite:
names={'Adel1','Adel2','Adel3'}% Cell array contains images' names
for i = 1 : length(names)
imwrite(Seg{i},['E:\Aneurysms\Images\names(i)_seg','.tif'])
% seg: segmentation function result
end
the previous code save only the last variable with the name: names(i)_seg
I want to save new images like: Adel1_seg, Adel2_seg,Adel3_seg
what is wrong in using imwrite ??
0 件のコメント
採用された回答
Michael Haderlein
2014 年 9 月 18 日
There's nothing wrong using imwrite, there's something wrong how you create the file name. Just use
['E:\Aneurysms\Images\' names{i} '_seg.tif']
その他の回答 (1 件)
Roger Wohlwend
2014 年 9 月 18 日
編集済み: Roger Wohlwend
2014 年 9 月 18 日
The function imwrite does exactly what you told it to do. The problem is that
['E:\Aneurysms\Images\names(i)_seg','.tif']
gives you a static text. It does not do what you want it to do. Replace it with the following code:
['E:\Aneurysms\Images\', names{i}, '_seg.tif']
That should solve your problem.
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!