eeg_checkset.m
来自「含有多种ICA算法的eeglab工具箱」· M 代码 · 共 1,234 行 · 第 1/4 页
M
1,234 行
% for non cellfun compatibility%% Revision 1.57 2002/08/14 02:01:08 arno% debugging epoch info%% Revision 1.56 2002/08/12 18:53:14 arno% errordlg2%% Revision 1.55 2002/08/12 18:51:58 arno% errordlg2%% Revision 1.54 2002/08/12 18:39:23 arno% questdlg2%% Revision 1.53 2002/08/12 00:16:46 arno% same%% Revision 1.52 2002/08/12 00:13:44 arno% same%% Revision 1.51 2002/08/12 00:05:44 arno% changing manual color%% Revision 1.50 2002/08/09 00:58:38 arno% text%% Revision 1.49 2002/08/09 00:39:18 arno% debugging epoch%% Revision 1.48 2002/08/08 21:55:59 arno% adding epoch creation%% Revision 1.47 2002/08/08 21:08:34 arno% *** empty log message ***%% Revision 1.46 2002/07/30 22:05:24 arno% adding disprej field%% Revision 1.45 2002/07/30 17:53:22 arno% adding color for rejection%% Revision 1.44 2002/07/29 16:42:00 arno% debugging%% Revision 1.43 2002/07/27 00:08:03 arno% debugging%% Revision 1.42 2002/07/26 18:06:41 arno% add warning%% Revision 1.41 2002/07/25 17:36:34 arno% debugging%% Revision 1.40 2002/07/25 17:34:48 arno% adding message when removing ICA array%% Revision 1.39 2002/07/25 17:12:55 arno% debugging gcompreject%% Revision 1.38 2002/07/24 18:40:07 arno% checking empty values in epochs%% Revision 1.37 2002/07/23 23:51:25 arno% removing error%% Revision 1.36 2002/07/23 22:23:41 arno% removing warning if icaact=[]%% Revision 1.35 2002/07/23 21:29:07 arno% empty icaact%% Revision 1.34 2002/07/23 00:13:29 arno% adding read float feature%% Revision 1.33 2002/06/25 13:40:00 arno% adding EEG.times%% Revision 1.32 2002/06/25 02:31:06 arno% gcompreject initialized to zeros for all components%% Revision 1.31 2002/06/25 00:45:59 arno% removing epoch info unofor;isation% ,%% Revision 1.30 2002/05/04 01:47:29 arno% same%% Revision 1.29 2002/05/04 01:46:42 arno% still correctin eventconsistency%% Revision 1.28 2002/05/04 01:45:13 arno% typo%% Revision 1.27 2002/05/04 01:44:26 arno% correcting typo%% Revision 1.26 2002/05/04 01:42:38 arno% cellfun bug correction%% Revision 1.25 2002/05/03 01:33:58 luca% debuging new event check%% Revision 1.24 2002/05/02 22:16:54 arno% speeding up event checks%% Revision 1.23 2002/05/01 18:58:08 luca% same%% Revision 1.22 2002/05/01 18:57:48 luca% same%% Revision 1.21 2002/05/01 18:57:05 luca% icaact reshape problem%% Revision 1.20 2002/04/30 15:21:44 scott% editted help msg -sm%% Revision 1.19 2002/04/20 18:45:02 arno% editing error message%% Revision 1.18 2002/04/18 16:14:25 scott% EEG.ref = 'No' by default -sm%% Revision 1.17 2002/04/18 02:37:54 scott% [same] -sm%% Revision 1.16 2002/04/18 02:35:42 scott% [same] -sm%% Revision 1.15 2002/04/18 02:34:08 scott% improved "empty dataset" msg -sm%% Revision 1.14 2002/04/11 23:34:49 arno% adding event check in event consistency%% Revision 1.13 2002/04/11 18:21:43 arno% add furhter check for EEG.ref%% Revision 1.12 2002/04/11 18:08:47 arno% adding average reference variable check% ,%% Revision 1.11 2002/04/10 00:42:55 arno% reprograming eventconsistency for higher speed%% Revision 1.10 2002/04/10 00:08:28 arno% debuging event consistency%% Revision 1.9 2002/04/10 00:03:03 arno% debuging event consistency%% Revision 1.8 2002/04/09 21:02:05 arno% adding further check to eventconsistency%% Revision 1.7 2002/04/09 20:11:33 arno% eventdesciption advanced checking%% Revision 1.6 2002/04/09 02:38:12 arno% bedugging epoch event consistency check%% Revision 1.5 2002/04/09 01:52:57 arno% adding check of event latencies%% Revision 1.4 2002/04/08 21:52:51 arno% checking event description consistency%% Revision 1.3 2002/04/08 20:49:26 arno% add check for the comments field%% Revision 1.2 2002/04/08 02:13:09 scott% improved wording of messages to user -sm%% Revision 1.1 2002/04/05 17:32:13 jorn% Initial revision%% 01-25-02 reformated help & license -ad % 01-26-02 chandeg events and trial condition format -ad% 01-27-02 debug when trial condition is empty -ad% 02-15-02 remove icawinv recompute for pop_epoch -ad & ja% 02-16-02 remove last modification and test icawinv separatelly -ad% 02-16-02 empty event and epoch check -ad% 03-07-02 add the eeglab options -ad% 03-07-02 corrected typos and rate/point calculation -ad & ja% 03-15-02 add channel location reading & checking -ad% 03-15-02 add checking of ICA and epochs with pop_up windows -ad% 03-27-02 recorrected rate/point calculation -ad & smfunction [EEG, res] = eeg_checkset( EEG, varargin );msg = '';res = 0; % 0 = OK, 1 = error, -1=warningif nargin < 1 help eeg_checkset; return;end;% checking multiple datasetsif isempty(EEG), return; end;if ~isfield(EEG, 'data'), return; end;if length(EEG) > 1 for index = 1:length(EEG) if ~isempty(EEG(index)) if ~isempty( varargin) [TMP, res] = eeg_checkset(EEG(index), varargin{:}); else [TMP, res] = eeg_checkset(EEG(index)); end; [EEG TMP] = eeg_store(EEG, TMP, index); end; end; return;end;if isempty(EEG.data) errordlg2(strvcat('Error: no data'), 'Error'); error('eeg_checkset error: no data'); return;end; if ~isempty( varargin) if isempty(EEG.data) errordlg2('Empty dataset -> File / Import data or File / Load existing dataset', 'Error'); error('eeg_checkset error: empty dataset'); return; end; end;com = sprintf('%s = eeg_checkset( %s );', inputname(1), inputname(1));res = [];% check name consistency% ----------------------if ~isempty(EEG.setname) if ~isstr(EEG.setname) EEG.setname = ''; else if size(EEG.setname,1) > 1 disp('eeg_checkset warning: invalid dataset name, removed'); EEG.setname = ''; end; end;else EEG.setname = '';end; % checking history and convert if necessary% -----------------------------------------if isfield(EEG, 'history') & size(EEG.history,1) > 1 allcoms = cellstr(EEG.history); EEG.history = deblank(allcoms{1}); for index = 2:length(allcoms) EEG.history = [ EEG.history 10 deblank(allcoms{index}) ]; end;end;% read data if necessary% ----------------------if isstr(EEG.data) fid = fopen([EEG.filepath EEG.data], 'r', 'ieee-le'); %little endian (see also pop_saveset) if fid == -1 disp(['file ' [EEG.filepath EEG.data] ' not found, trying local folder']); fid = fopen(EEG.data, 'r', 'ieee-le'); %little endian (see also pop_saveset) if fid == -1 errordlg2(['Cannot open data file ''' [EEG.data] ''''], 'error'); error('File not found'); end; fprintf('Reading float file ''%s''...\n', [EEG.data]); else fprintf('Reading float file ''%s''...\n', [EEG.filepath EEG.data]); end; EEG.data = fread(fid, [EEG.nbchan Inf], 'float32');end;if isnumeric(EEG.data) v = version; if isempty(findstr(v, 'R14')) EEG.data = double(EEG.data); else EEG.data = single(EEG.data); end;end;% verify the type of the variables% -------------------------------- % data dimensions ------------------------- if size(EEG.data,1) ~= EEG.nbchan disp( [ 'eeg_checkset warning: number of columns in data (' int2str(size(EEG.data,1)) ... ') does not match the number of channels (' int2str(EEG.nbchan) '): corrected' ]); res = com; EEG.nbchan = size(EEG.data,1); end; if (ndims(EEG.data)) < 3 & (EEG.pnts > 1) if mod(size(EEG.data,2), EEG.pnts) ~= 0 if popask( [ 'eeg_checkset error: the number of frames does not divide the number of columns in the data.' 10 ... 'Should EEGLAB attempt to abort operation ?' 10 '(press Cancel to fix the problem from the command line)']) error('eeg_checkset error: user abort'); %res = com; %EEG.pnts = size(EEG.data,2); %EEG = eeg_checkset(EEG); %return; else res = com; return; %error( 'eeg_checkset error: number of points does not divide the number of columns in data'); end; else if EEG.trials > 1 disp( 'eeg_checkset note: data array made 3-D'); res = com; end; EEG.data = reshape(EEG.data, EEG.nbchan, EEG.pnts, size(EEG.data,2)/EEG.pnts);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?