i will explain how to export figures to a file using hgexport with matlab.
here is how:
first you need to create the figure:
h.figure = figure
clf
position = get(gcf,'Position');
set(h.figure,'Color','w',...
'PaperPositionMode', 'auto', ...
'Units','in','Position',[position(1:2) 6 2.5 ],...
'PaperPosition',[0.25 0.25 6 2.5])
then, plot the figure. use all the commands you like, like plot, stairs and subplot...
at the end, export the figure using hgexport:
myStyle = hgexport('factorystyle');
myStyle.Format = 'png';
myStyle.Width = 6;
myStyle.Height = 2.5;
myStyle.Resolution = 300;
myStyle.Units = 'inch';
myStyle.FixedFontSize = 12;
hgexport(h.figure,'fileout.png',myStyle,'Format','png')
with Width and Height you can control the size of the file in inch (units).