【发布时间】:2014-05-14 15:30:33
【问题描述】:
figure;
histogram = hist(np,180);
name=['histogram-' int2str(k) '.png'];
%% k is the iterator so basically I want to save all the images using a loop.
imwrite(out,name);
我得到的图像只是一条水平线。有人知道如何解决这个问题吗?
【问题讨论】:
figure;
histogram = hist(np,180);
name=['histogram-' int2str(k) '.png'];
%% k is the iterator so basically I want to save all the images using a loop.
imwrite(out,name);
我得到的图像只是一条水平线。有人知道如何解决这个问题吗?
【问题讨论】:
你可以用 savefig 代替 imwrite
这里是文档 http://www.mathworks.ch/ch/help/matlab/ref/savefig.html
savefig(h,filename)
h 是图形的句柄。你可以跳过 h 来保存当前的图。
(edit) savefig 可能不存在,具体取决于 MATLAB 版本。 2012b不退出。
所以saveas 可能会更好:
f=figure;
hist([1 2 2 3]);
saveas(f, 'histogram-1.png')
这在 MATALB 2012b 中有效。您也可以将其另存为 .fig。
【讨论】: