saving images in loop
1 view (last 30 days)
Show older comments
Hi,
frateMaps is a cell array. I would like to save images for each vector in frateMaps.
I could see the images for each loop but the images are not saved. I would like to save each image with labelling 1, 2, 3 etc based on loop number.
I tried to modify second parts of code but didn't work. could anyone please advise how to save? thank you.
for i = 1: length(fwdposx)
figure('color','w')
drawfield(frateMaps{i},'jet',max(max(frateMaps{i})));
titleStr = sprintf('%s%s%3.1f%s',tFileList{jj}(1:end-2),' Peak = ',max(max(frateMaps{i})),' Hz');
title(titleStr,'FontSize',20,'Interpreter','none');
axis off
axis image
drawnow;
ratemapImage= strcat(sessions{ii},[funcName,' Map Image ',date],'\',tFileList{jj}(1:end-2),'_forward rateMap_run');
imageStore(gcf,6,ratemapImage,150);%tif format, 150dpi
imageStore(gcf,3,ratemapImage,150);%eps format, 150dpi
close;
end
0 Comments
Answers (1)
KSSV
on 28 May 2020
for i = 1: length(fwdposx)
figure('color','w')
drawfield(frateMaps{i},'jet',max(max(frateMaps{i})));
titleStr = sprintf('%s%s%3.1f%s',tFileList{jj}(1:end-2),' Peak = ',max(max(frateMaps{i})),' Hz');
title(titleStr,'FontSize',20,'Interpreter','none');
axis off
axis image
drawnow;
saveas(gcf,['image',num2str(i),'.png'])
ratemapImage= strcat(sessions{ii},[funcName,' Map Image ',date],'\',tFileList{jj}(1:end-2),'_forward rateMap_run');
imageStore(gcf,6,ratemapImage,150);%tif format, 150dpi
imageStore(gcf,3,ratemapImage,150);%eps format, 150dpi
close;
end
See Also
Categories
Find more on Convert Image Type 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!