-
Notifications
You must be signed in to change notification settings - Fork 3
/
imsave.m
27 lines (26 loc) · 1013 Bytes
/
imsave.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function imsave(fileName,figFolder,fig,name,fullScreen,res)
%IMSAVE Save figure as png and fig.
% IMSAVE(fileName,figFolder,fig,name,fullScreen,res) Saves figure and
% sets to fullscreen size if fullScreen is true.
%
% Inputs:
%
% FIGFOLDER: Figure subfolder to save files
% FIG : Figure handle
% NAME : Title and file name for figure
% FILENAME : Name of .mat file to read
% RES : Image resolution setting in dpi for saving image
% Set to full screen
if fullScreen == 1
screensize = get(groot,'Screensize');
fig.Position = [1 1 screensize(3) floor(screensize(4)*0.86)];
elseif fullScreen == 0.5
screensize = get(groot,'Screensize');
fig.Position = [1 1 floor(screensize(3)*0.5) floor(screensize(4)*0.86)];
end
% Save figure
path = strcat(figFolder,"\",name,"\",fileName,'-',name);
fig.CreateFcn = 'set(gcf,''visible'',''on'')';
savefig(fig,strcat(path,'.fig'));
exportgraphics(fig,strcat(path,'.png'),'Resolution',res);
end