0001 function eeg_save_graphics(F,type,p,confirm)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 if exist('F','var'),
0039 if isempty(F), F = gcf; end
0040 else
0041 F = gcf;
0042 end
0043 if exist('type','var'),
0044 if isempty(type), type = 'png'; end
0045 else
0046 type = 'png';
0047 end
0048 if exist('confirm','var'),
0049 if isempty(confirm), confirm = 0; end
0050 else
0051 confirm = 0;
0052 end
0053
0054
0055 [path,file,ext] = fileparts(strcat(p.volt.path,filesep,p.volt.file));
0056 if p.topoView,
0057 file = strcat(file, sprintf('_%s_%08.2f',p.topoView,p.volt.sampleTime),'.',type);
0058 else
0059 file = strcat(file, sprintf('_%08.2f',p.volt.sampleTime),'.',type);
0060 end
0061 file = fullfile(path,file);
0062
0063 if confirm,
0064 [filename, filepath] = uiputfile(file, 'EEG Save Graphic');
0065 if ~isequal(filename,0),
0066 file = fullfile(filepath,filename);
0067 fprintf('EEG_SAVE_GRAPHIC: Saving to:...\n...%s\n',file);
0068 saveas(F,file);
0069 end
0070
0071 else
0072 type = lower(type);
0073 if strmatch(type,'png'),
0074 driver = '-dpng';
0075 option1 = '-noui';
0076 option2 = '-r300';
0077
0078 fprintf('EEG_SAVE_GRAPHIC: Saving to:...\n...%s\n',file);
0079 print(F,driver,option1,option2,file);
0080 elseif strmatch(type,'jpeg'),
0081 driver = '-djpeg90';
0082 option1 = '-r300';
0083 fprintf('EEG_SAVE_GRAPHIC: Saving to:...\n...%s\n',file);
0084 print(F,driver,option1,file);
0085 elseif strmatch(type,'eps'),
0086 driver = '-depsc2';
0087 option1 = '-r300';
0088 option2 = '-tiff';
0089 fprintf('EEG_SAVE_GRAPHIC: Saving to:...\n...%s\n',file);
0090 print(F,driver,option1,option2,file);
0091 elseif strmatch(type,'tiff'),
0092 driver = '-dtiff';
0093 option1 = '-r300';
0094 fprintf('EEG_SAVE_GRAPHIC: Saving to:...\n...%s\n',file);
0095 print(F,driver,option1,file);
0096 else
0097 fprintf('EEG_SAVE_GRAPHIC: Saving to:...\n...%s\n',file);
0098 saveas(F,file);
0099 end
0100 end
0101
0102 return