Home > eeg > utils > save_marks.m

save_marks

PURPOSE ^

This function can be called to save the current set of region marks

SYNOPSIS ^

function save_marks(EEG)

DESCRIPTION ^

 This function can be called to save the current set of region marks
 (stored in the .winrej field of 'UserData' in the eegplot figure) to a
 mat-file located in the same directory as the set file that is being
 edited 

 save_marks(EEG);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function save_marks(EEG)
0002 % This function can be called to save the current set of region marks
0003 % (stored in the .winrej field of 'UserData' in the eegplot figure) to a
0004 % mat-file located in the same directory as the set file that is being
0005 % edited
0006 %
0007 % save_marks(EEG);
0008 %
0009 
0010 % 27Jun2012 Petr Janata
0011 
0012 % Get the UserData from the current figure and make sure that it has a
0013 % .winrej field
0014 
0015 if nargin < 1
0016     error('Please provide EEG info structure')
0017 end
0018 
0019 g = get(gcf,'UserData');
0020 if ~isfield(g, 'winrej')
0021     error('No winrej field found in UserData')
0022 end
0023 
0024 % Check to see if there are any marked regions to save
0025 if isempty(g.winrej)
0026     fprintf('No marked regions to save\n');
0027     return
0028 end
0029 
0030 % Specify a file to write rejection information out to
0031 [fpath,fstub,fext] = fileparts(EEG.filename);
0032 outfname = fullfile(EEG.filepath, sprintf('%s_marks.mat',fstub));
0033 
0034 winrej = g.winrej;
0035 
0036 fprintf('Saving %d marks to file: %s\n', size(winrej,1), outfname);
0037 save(outfname, 'winrej');
0038

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003