How to save save split images in multiple filenames?
Show older comments
I have a code which shows the multiple images of a scanned *.tif document.
for i=1:5
d=imshow(imread('gi2.tif',i));
figure;
end
I need to save these images as multiple files. I used the following code for that:
basename='im_'
for i=1:5
d=imshow(imread('gi2.tif',i));
figure;
filename=[basename,num2str(i)];
end
But the code is just creating a variable filename with data im_5. I also tried using "sprintf" using the following code:
for i=1:5
d=imread('gi2.tif',i));
filename=sprintf('im_%d.jpg',i)
end
But this basically prints the filename im_<no.> and nothing else.
Please support!!
Accepted Answer
More Answers (0)
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!