I have a figure that I plot several subplots on. I create this figure associating it with a handle as:
%Create Figure----------------------------------------------------------
sz = [800 1800]; % figure size
screensize = get(groot,'ScreenSize');xpos = ceil((screensize(3)-sz(2))/2); % center the figure on the
ypos = ceil((screensize(4)-sz(1))/2); % center the figure on thefigHandle=figure('position',[xpos, ypos, sz(2), sz(1)]);
I want to save the complete figure with all subplots to an image file. However using the code below is failing to save anything.
name='results'name=['c:\',name,'.png']set(figHandle,'Units','Inches');pos = get(figHandle,'Position');set(figHandle,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])print(figHandle,'filename','-dpng','-r0')
Best Answer