![]() |
OptFEM2DP1 Toolbox
V1.2
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
|
00001 function SaveFigure(issave,Name,percent) 00002 % function SaveFigure(issave,Name,percent) 00003 % To manage the saving of figures. Save in eps, jpg and png format. 00004 % 00005 % Parameters: 00006 % issave: boolean. If true saving figure is done. 00007 % Name: name of the destination file without extension (string) 00008 % percent: value for resizing the figure (only png format under unix) 00009 % 00010 % Copyright: 00011 % See \ref license 00012 if issave 00013 [SUCCESS,MESSAGE,MESSAGEID] = mkdir('images'); 00014 eval(sprintf('print -depsc2 images/%s.eps',Name)) 00015 fprintf(' -> save figure(%d) in images/%s.eps\n',gcf,Name); 00016 eval(sprintf('print -djpeg90 images/%s.jpg',Name)) 00017 fprintf(' -> save figure(%d) in images/%s.jpg\n',gcf,Name); 00018 if isunix 00019 system(sprintf('convert -resize %d%% images/%s.eps images/%s.png',percent,Name,Name)); 00020 fprintf(' -> save figure(%d) in images/%s.png (resize %d%%)\n',gcf,Name,percent); 00021 else 00022 eval(sprintf('print -dpng images/%s.png',Name)) 00023 fprintf(' -> save figure(%d) in images/%s.png \n',gcf,Name); 00024 end 00025 end