0001 function insert_marks(EEG)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 if nargin < 1
0015 error('Please provide EEG info structure')
0016 end
0017
0018 g = get(gcf,'UserData');
0019 if ~isfield(g, 'winrej')
0020 error(['No winrej field found in UserData.' ...
0021 'Make sure that the EEG data are showing in a window'])
0022 end
0023
0024
0025 [fpath,fstub,fext] = fileparts(EEG.filename);
0026 outfname = fullfile(EEG.filepath, sprintf('%s_marks.mat',fstub));
0027
0028
0029 if ~exist(outfname,'file')
0030 error('File with marks does not exist: %s\n', outfname)
0031 end
0032
0033 fprintf('Loading marks from file: %s\n', outfname);
0034 load(outfname, 'winrej');
0035 fprintf('Found %d marks\n', size(winrej,1));
0036
0037 g.winrej = winrej;
0038
0039
0040
0041 set(gcf,'UserData',g);