Let's say you are working in the loop, use the following for k=1:30 imwrite(filename, sprintf('name of the image to be stored_%d.png',k) ); end Hope that it helps. Ghani
I'd also recommend the use of fullfile() to make certain where you're going to save it rather than just saving it wherever the current folder happens to be. Since (because you're saving cdata) it appears you're saving more than just an image, but an image with perhaps some graphics in the overlay, you might be interested in Oliver's export_fig in the File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A29192 It's the most downloaded file.
Yes. What do you mean over and over again? You never said anything about this being in a loop where you need to change the filename inside the loop. If you do, use sprintf() to construct the filename. Or see the FAQ http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F if you got the filenames into a cell array from the dir() function.