Save exact image output from imagesc in matlab -


rainbow

hi , want save image produced imagesc(magic(3)), exact rainbow representation, possible?

thanks.

this question might duplicate , not . looked @ solution similar question @ site , did not satisfy me . have looked matlab center , close answer got 1 , @ bottom of http://goo.gl/p907wr

to save figure file (don't matter how created), 1 should do:

saveas(figurehandle,'filename','format') 

where figurehandle gcf handle, means: get current figure.

as pointed in discussion, if doesn't want ticks shown, person can add:

set(gca,'xtick',[]) set(gca,'ytick',[]) 

where gca handle current axis, gcf. if have more 1 axis, don't forget "handle handles". returned when create them, i.e.:

hfig = figure(pairvaluedproperties); % create , figure handle haxes1 = suplot(2,1,1,pairvaluedproperties); % create , upper axes handle haxes2 = suplot(2,1,2,pairvaluedproperties); % create , bottom axes handle 

where pair value figure or axes properties declared in following syntax:

'propertyname1',propertyvalue1,'propertyname2',propertyvalue2,…

here matlab documentation figure , axes properties, , saveas method.


example:

the image saved following code:

figure  imagesc(magic(3)) set(gca,'xtick',[]) % remove ticks in x axis! set(gca,'ytick',[]) % remove ticks in y axis set(gca,'position',[0 0 1 1]) % make axes occupy hole figure saveas(gcf,'figure','png') 

figure without white border


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -