| OptFEM2D Toolbox for Matlab V1.2b1 Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D

- Main Page
- Related Pages
- Files

- File List
- File Members

All Files Functions Pages
SaveFigure.m
Go to the documentation of this file.
1 function SaveFigure(issave,Name,percent)
2 % function SaveFigure(issave,Name,percent)
3 % To manage the saving of figures. Save in eps, jpg and png format.
4 %
5 % Parameters:
6 % issave: boolean. If true saving figure is done.
7 % Name: name of the destination file without extension (string)
8 % percent: value for resizing the figure (only png format under unix)
9 %
10 %
11 % OptFEM2DP1 [V1.2b1] - 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 issave
27 [SUCCESS,MESSAGE,MESSAGEID] = mkdir('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 if isunix
33 system(sprintf('convert -resize %d%% images/%s.eps images/%s.png',percent,Name,Name));
34 fprintf(' -> save figure(%d) in images/%s.png (resize %d%%)\n',gcf,Name,percent);
35 else
36 eval(sprintf('print -dpng images/%s.png',Name))
37 fprintf(' -> save figure(%d) in images/%s.png \n',gcf,Name);
38 end
39 end