0001 function screen2jpeg(filename)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 if nargin < 1
0012 error('Not enough input arguments!')
0013 end
0014
0015 oldscreenunits = get(gcf,'Units');
0016 oldpaperunits = get(gcf,'PaperUnits');
0017 oldpaperpos = get(gcf,'PaperPosition');
0018 set(gcf,'Units','pixels');
0019 scrpos = get(gcf,'Position');
0020 newpos = scrpos/100;
0021 set(gcf,'PaperUnits','inches',...
0022 'PaperPosition',newpos)
0023 eval(['print -djpeg ''' filename ''' -r100'])
0024 drawnow
0025 set(gcf,'Units',oldscreenunits,...
0026 'PaperUnits',oldpaperunits,...
0027 'PaperPosition',oldpaperpos)