Suppose I have several figures open in matlab. I would like some function I can call, e.g save_all_figures_to_directory('dir_name'), that would iterate over all figures and save them to the specified folder. How do I do this?
function save_all_figures_to_directory(dir_name)
figlist=findobj('type','figure');
for i=1:numel(figlist)
saveas(figlist(i),fullfile(dir_name,['figure' num2str(figlist(i)) '.fig']));
end
end
Lets say I have a 3D array 'img' (x, y, frame) and want to save it as a TIFF. So far I was doing it by saving one-by-one like this:
for K=1:length(img(1, 1, :))
outputFileName = sprintf('img_%d.tif',K);
…