printing matlab figures to memory
October 28, 2006 11:36 AM
Subscribe
MatLabFilter: Printing figures to memory? I know that I can use the versatile print command to print a figure to a file. But how might I be able to turn a figure into a matrix in matlab's memory?
previously I've printed figures to files then opened those files into memory but this seems like a horrible kludge. any way to turn an onscreen figure directly into a matrix? specifically I'm interested in creating really busy figures using typical matlab handle graphics, but I'd like to periodically flatten the figure into a matrix then add to it continually without bogging matlab down with a million graphic objects that would take an eternity to render. any ideas?
posted by garethspor to computers & internet (3 comments total)
getframecommand will give you a matrix of the current axes. If you want the entire figure area, you'll want to do something like:pos = get(gcf,'Position');
I= getframe(gcf,[0 0 pos(3) pos(4)]);
And then to plot the image on the (new) axes,
image(I.cdata)
set(gca,'Position',[0 0 1 1])
axis off
posted by yarmond at 12:14 PM on October 28, 2006