Hi I have a loop and each time it separates and image and i want to save it automatically with different image name. I have following code
figure
for n=1:Ne
[r,c] = find(L==n);
n1=imagen(min(r):max(r),min(c):max(c));
imshow(~n1);
imwrite(~n1, test.jpg);
pause(0.5)
end
Problem I have is in imwrite(~n1, test.jpg); it only saves one image while I need to save it so that all are saved like test1.jpg, test2.jpg so on …anyone has an idea how to do that?
Thank you for your help
I like to use something like this:
to pad the filename with zeros, so they are nicely sorted in the diretory.