MATLAB: How to save images using for loop

digital image processingimage processing

I have an error using imwrite:
names={'Adel1','Adel2','Adel3'}% Cell array contains images' names
for i = 1 : length(names)
% seg: segmentation function result
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 ??

Best Answer

  • 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']