MATLAB: Hii…i want to save the images as abc1.pgm, abc2.pgm, abc3.pgm…abc5.pgm

ashish uthama

i tried the following code
filename=spprimtf('E:\\prajube\\abc1%d.pgm',x);
imwrite(imge1,filename);
still it saves only the last photo…for eg. suppose we have to click 5 images.. it just saves abc5.pgm and abc1.pgm to abc4.pgm are lost
please help!!! 🙁

Best Answer

for k=1:3
filename=sprintf('E:\\prajube\\abc1%d.pgm',k)
imwrite(image1{k},filename);
end