MATLAB: Automatic Iterative Varible Naming

image processing

I am working with a lot of images and my workflow has been designed to load up single images, manipulate the image, and write the image back out to a .jpg file. Unfortunatly I recently realised that .jpg is not a loss-less format and I am currently trying to write my image files to .mat variables.
The image write command was useful since I could append text to the file names. Example: load image1.jpg, cropp image1, save as croppedimage1.jpg.
I would like to restore this functionality to my code usings variable names. It may look something like this….
A = [ 1 2 3 4 5 6 7 8 9 10];
for i = 1:10
B = A(i);
C = B*2;
save (i)C % where the variable name would be 1C.mat, 2C.mat etc.
end
I am not sure if this even the right approach.
Thanks for any suggestions.

Best Answer

FileName=num2str(i,'C%d.mat')