How do I save histogram to file in matlab?
问题 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); The image I got is only a horizontal line. Does someone know how to fix this? 回答1: you can use savefig instead of imwrite here is the doc http://www.mathworks.ch/ch/help/matlab/ref/savefig.html savefig(h,filename) h is the handle of figure. you could skip h to save the current figure. (edit) savefig may not be there depending