How to save images using for loop?
Mostrar comentarios más antiguos
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 ??
Respuesta aceptada
Más respuestas (1)
Roger Wohlwend
el 18 de Sept. de 2014
Editada: Roger Wohlwend
el 18 de Sept. de 2014
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.
1 comentario
Nisreen Sulayman
el 18 de Sept. de 2014
Categorías
Más información sobre Images en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!