OptFEM2DP1  1.0
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
 All Files Functions Variables Groups Pages
SaveFigure.m
Go to the documentation of this file.
1 function SaveFigure(SAVEFIGURE,Name,percent)
2 % function SaveFigure(SAVEFIGURE,Name,percent)
3 % To manage the saving of figures
4 %
5 % Parameters:
6 % SAVEFIGURE: boolean. If true saving figure is done.
7 % Name: name of the destination file without extension (string)
8 % percent: value for resizing the figure
9 %
10 %
11 % OptFEM2DP1 [V1.0d] - Copyright (C) 2013 CJS (LAGA)
12 %
13 % This file is part of OptFEM2DP1.
14 % OptFEM2DP1 is free software: you can redistribute it and/or modify
15 % it under the terms of the GNU General Public License as published by
16 % the Free Software Foundation, either version 3 of the License, or
17 % (at your option) any later version.
18 %
19 % OptFEM2DP1 is distributed in the hope that it will be useful,
20 % but WITHOUT ANY WARRANTY; without even the implied warranty of
21 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 % GNU General Public License for more details.
23 %
24 % You should have received a copy of the GNU General Public License
25 % along with this program. If not, see <http://www.gnu.org/licenses/>.
26 if SAVEFIGURE
27  system(sprintf('mkdir -p images'));
28  eval(sprintf('print -depsc2 images/%s.eps',Name))
29  fprintf(' -> save figure(%d) in images/%s.eps\n',gcf,Name);
30  eval(sprintf('print -djpeg90 images/%s.jpg',Name))
31  fprintf(' -> save figure(%d) in images/%s.jpg\n',gcf,Name);
32  system(sprintf('convert -resize %d%% images/%s.jpg images/%s.png',percent,Name,Name));
33  fprintf(' -> save figure(%d) in images/%s.png (resize %d%%)\n',gcf,Name,percent);
34 end