|
a |
|
b/eeglab.m |
|
|
1 |
% eeglab() - Matlab graphic user interface environment for |
|
|
2 |
% electrophysiological data analysis incorporating the ICA/EEG toolbox |
|
|
3 |
% (Makeig et al.) developed at CNL / The Salk Institute, 1997-2001. |
|
|
4 |
% Released 11/2002- as EEGLAB (Delorme, Makeig, et al.) at the Swartz Center |
|
|
5 |
% for Computational Neuroscience, Institute for Neural Computation, |
|
|
6 |
% University of California San Diego (http://sccn.ucsd.edu/). |
|
|
7 |
% User feedback welcome: email eeglab@sccn.ucsd.edu |
|
|
8 |
% |
|
|
9 |
% Authors: Arnaud Delorme and Scott Makeig, with substantial contributions |
|
|
10 |
% from Colin Humphries, Sigurd Enghoff, Tzyy-Ping Jung, plus |
|
|
11 |
% contributions from Tony Bell, Te-Won Lee, Luca Finelli and many |
|
|
12 |
% other contributors. |
|
|
13 |
% |
|
|
14 |
% Description: |
|
|
15 |
% EEGLAB is Matlab-based software for processing continuous or event-related |
|
|
16 |
% EEG or other physiological data. It is designed for use by both novice and |
|
|
17 |
% expert Matlab users. In normal use, the EEGLAB graphic interface calls |
|
|
18 |
% graphic functions via pop-up function windows. The EEGLAB history mechanism |
|
|
19 |
% can save the resulting Matlab calls to disk for later incorporation into |
|
|
20 |
% Matlab scripts. A single data structure ('EEG') containing all dataset |
|
|
21 |
% parameters may be accessed and modified directly from the Matlab commandline. |
|
|
22 |
% EEGLAB now recognizes "plugins," sets of EEGLAB functions linked to the EEGLAB |
|
|
23 |
% main menu through an "eegplugin_[name].m" function (Ex. >> help eeplugin_besa.m). |
|
|
24 |
% |
|
|
25 |
% Usage: 1) To (re)start EEGLAB, type |
|
|
26 |
% >> eeglab % Ignores any loaded datasets |
|
|
27 |
% >> eeglab nogui % Do not pop up GUI |
|
|
28 |
% 2) To redaw and update the EEGLAB interface, type |
|
|
29 |
% >> eeglab redraw % Scans for non-empty datasets |
|
|
30 |
% >> eeglab rebuild % Closes and rebuilds the EEGLAB window |
|
|
31 |
% >> eeglab versions % State EEGLAB version number |
|
|
32 |
% |
|
|
33 |
% >> type "LICENSE" % the EEGLAB open source license |
|
|
34 |
% >> web http://eeglab.org % the EEGLAB tutorial |
|
|
35 |
% >> help eeg_checkset % the EEG dataset structure |
|
|
36 |
% |
|
|
37 |
% GUI Functions calling eponymous processing and plotting functions: |
|
|
38 |
% ------------------------------------------------------------------ |
|
|
39 |
% <a href="matlab:helpwin pop_eegfilt">pop_eegfilt</a> - bandpass filter data (eegfilt()) |
|
|
40 |
% <a href="matlab:helpwin pop_eegplot">pop_eegplot</a> - scrolling multichannel data viewer (eegplot()) |
|
|
41 |
% <a href="matlab:helpwin pop_eegthresh">pop_eegthresh</a> - simple thresholding method (eegthresh()) |
|
|
42 |
% <a href="matlab:helpwin pop_envtopo">pop_envtopo</a> - plot ERP data and component contributions (envtopo()) |
|
|
43 |
% <a href="matlab:helpwin pop_epoch">pop_epoch</a> - extract epochs from a continuous dataset (epoch()) |
|
|
44 |
% <a href="matlab:helpwin pop_erpimage">pop_erpimage</a> - plot single epochs as an image (erpimage()) |
|
|
45 |
% <a href="matlab:helpwin pop_jointprob">pop_jointprob</a> - reject epochs using joint probability (jointprob()) |
|
|
46 |
% <a href="matlab:helpwin pop_loadbva">pop_loadbva</a> - load Brain Vision Analyser matlab files |
|
|
47 |
% <a href="matlab:helpwin pop_plotdata">pop_plotdata</a> - plot data epochs in rectangular array (plotdata()) |
|
|
48 |
% <a href="matlab:helpwin pop_readegi">pop_readegi</a> - load binary EGI data file (readegi()) |
|
|
49 |
% <a href="matlab:helpwin pop_rejkurt">pop_rejkurt</a> - compute data kurtosis (rejkurt()) |
|
|
50 |
% <a href="matlab:helpwin pop_rejtrend">pop_rejtrend</a> - reject EEG epochs showing linear trends (rejtrend()) |
|
|
51 |
% <a href="matlab:helpwin pop_resample">pop_resample</a> - change data sampling rate (resample()) |
|
|
52 |
% <a href="matlab:helpwin pop_rmbase">pop_rmbase</a> - remove epoch baseline (rmbase()) |
|
|
53 |
% <a href="matlab:helpwin pop_runica">pop_runica</a> - run infomax ICA decomposition (runica()) |
|
|
54 |
% <a href="matlab:helpwin pop_newtimef">pop_newtimef</a> - event-related time-frequency (newtimef()) |
|
|
55 |
% <a href="matlab:helpwin pop_timtopo">pop_timtopo</a> - plot ERP and scalp maps (timtopo()) |
|
|
56 |
% <a href="matlab:helpwin pop_topoplot">pop_topoplot</a> - plot scalp maps (topoplot()) |
|
|
57 |
% <a href="matlab:helpwin pop_snapread">pop_snapread</a> - read Snapmaster .SMA files (snapread()) |
|
|
58 |
% <a href="matlab:helpwin pop_newcrossf">pop_newcrossf</a> - event-related cross-coherence (newcrossf()) |
|
|
59 |
% <a href="matlab:helpwin pop_spectopo">pop_spectopo</a> - plot all channel spectra and scalp maps (spectopo()) |
|
|
60 |
% <a href="matlab:helpwin pop_plottopo">pop_plottopo</a> - plot a data epoch in a topographic array (plottopo()) |
|
|
61 |
% <a href="matlab:helpwin pop_readedf">pop_readedf</a> - read .EDF EEG data format (readedf()) |
|
|
62 |
% <a href="matlab:helpwin pop_headplot">pop_headplot</a> - plot a 3-D data scalp map (headplot()) |
|
|
63 |
% <a href="matlab:helpwin pop_reref">pop_reref</a> - re-reference data (reref()) |
|
|
64 |
% <a href="matlab:helpwin pop_signalstat">pop_signalstat</a> - plot signal or component statistic (signalstat()) |
|
|
65 |
% |
|
|
66 |
% Other GUI functions: |
|
|
67 |
% ------------------- |
|
|
68 |
% <a href="matlab:helpwin pop_chanevent">pop_chanevent</a> - import events stored in data channel(s) |
|
|
69 |
% <a href="matlab:helpwin pop_comments">pop_comments</a> - edit dataset comment ('about') text |
|
|
70 |
% <a href="matlab:helpwin pop_compareerps">pop_compareerps</a> - compare two dataset ERPs using plottopo() |
|
|
71 |
% <a href="matlab:helpwin pop_prop">pop_prop</a> - plot channel or component properties (erpimage, spectra, map) |
|
|
72 |
% <a href="matlab:helpwin pop_copyset">pop_copyset</a> - copy dataset |
|
|
73 |
% <a href="matlab:helpwin pop_dispcomp">pop_dispcomp</a> - display component scalp maps with reject buttons |
|
|
74 |
% <a href="matlab:helpwin pop_editeventfield">pop_editeventfield</a> - edit event fields |
|
|
75 |
% <a href="matlab:helpwin pop_editeventvals">pop_editeventvals</a> - edit event values |
|
|
76 |
% <a href="matlab:helpwin pop_editset">pop_editset</a> - edit dataset information |
|
|
77 |
% <a href="matlab:helpwin pop_export">pop_export</a> - export data or ica activity to ASCII file |
|
|
78 |
% <a href="matlab:helpwin pop_expica">pop_expica</a> - export ica weights or inverse matrix to ASCII file |
|
|
79 |
% <a href="matlab:helpwin pop_icathresh">pop_icathresh</a> - choose rejection thresholds (in development) |
|
|
80 |
% <a href="matlab:helpwin pop_importepoch">pop_importepoch</a> - import epoch info ASCII file |
|
|
81 |
% <a href="matlab:helpwin pop_importevent">pop_importevent</a> - import event info ASCII file |
|
|
82 |
% <a href="matlab:helpwin pop_importpres">pop_importpres</a> - import Presentation info file |
|
|
83 |
% <a href="matlab:helpwin pop_importev2">pop_importev2</a> - import Neuroscan ev2 file |
|
|
84 |
% <a href="matlab:helpwin pop_loadset">pop_loadset</a> - load dataset |
|
|
85 |
% <a href="matlab:helpwin pop_mergeset">pop_mergeset</a> - merge two datasets |
|
|
86 |
% <a href="matlab:helpwin pop_rejepoch">pop_rejepoch</a> - reject pre-identified epochs in a EEG dataset |
|
|
87 |
% <a href="matlab:helpwin pop_rejspec">pop_rejspec</a> - reject based on spectrum (computes spectrum -% eegthresh) |
|
|
88 |
% <a href="matlab:helpwin pop_saveh">pop_saveh</a> - save EEGLAB command history |
|
|
89 |
% <a href="matlab:helpwin pop_saveset">pop_saveset</a> - save dataset |
|
|
90 |
% <a href="matlab:helpwin pop_select">pop_select</a> - select data (epochs, time points, channels ...) |
|
|
91 |
% <a href="matlab:helpwin pop_selectevent">pop_selectevent</a> - select events |
|
|
92 |
% <a href="matlab:helpwin pop_subcomp">pop_subcomp</a> - subtract components from data |
|
|
93 |
% |
|
|
94 |
% Non-GUI functions use for handling the EEG structure: |
|
|
95 |
% ---------------------------------------------------- |
|
|
96 |
% <a href="matlab:helpwin eeg_checkset">eeg_checkset</a> - check dataset parameter consistency |
|
|
97 |
% <a href="matlab:helpwin eeg_context">eeg_context</a> - return info about events surrounding given events |
|
|
98 |
% <a href="matlab:helpwin pop_delset">pop_delset</a> - delete dataset |
|
|
99 |
% <a href="matlab:helpwin pop_editoptions">pop_editoptions</a> - edit the option file |
|
|
100 |
% <a href="matlab:helpwin eeg_emptyset">eeg_emptyset</a> - empty dataset |
|
|
101 |
% <a href="matlab:helpwin eeg_epochformat">eeg_epochformat</a> - convert epoch array to structure |
|
|
102 |
% <a href="matlab:helpwin eeg_eventformat">eeg_eventformat</a> - convert event array to structure |
|
|
103 |
% <a href="matlab:helpwin eeg_getepochevent">eeg_getepochevent</a> - return event values for a subset of event types |
|
|
104 |
% <a href="matlab:helpwin eeg_global">eeg_global</a> - global variables |
|
|
105 |
% <a href="matlab:helpwin eeg_multieegplot">eeg_multieegplot</a> - plot several rejections (using different colors) |
|
|
106 |
% <a href="matlab:helpwin eeg_options">eeg_options</a> - option file |
|
|
107 |
% <a href="matlab:helpwin eeg_rejsuperpose">eeg_rejsuperpose</a> - use by rejmenu to superpose all rejections |
|
|
108 |
% <a href="matlab:helpwin eeg_rejmacro">eeg_rejmacro</a> - used by all rejection functions |
|
|
109 |
% <a href="matlab:helpwin pop_rejmenu">pop_rejmenu</a> - rejection menu (with all rejection methods visible) |
|
|
110 |
% <a href="matlab:helpwin eeg_retrieve">eeg_retrieve</a> - retrieve dataset from ALLEEG |
|
|
111 |
% <a href="matlab:helpwin eeg_store">eeg_store</a> - store dataset into ALLEEG |
|
|
112 |
% |
|
|
113 |
% Help functions: |
|
|
114 |
% -------------- |
|
|
115 |
% <a href="matlab:helpwin eeg_helpadmin">eeg_helpadmin</a> - help on admin function |
|
|
116 |
% <a href="matlab:helpwin eeg_helphelp">eeg_helphelp</a> - help on help |
|
|
117 |
% <a href="matlab:helpwin eeg_helpmenu">eeg_helpmenu</a> - EEG help menus |
|
|
118 |
% <a href="matlab:helpwin eeg_helppop">eeg_helppop</a> - help on pop_ and eeg_ functions |
|
|
119 |
% <a href="matlab:helpwin eeg_helpsigproc">eeg_helpsigproc</a> - help on |
|
|
120 |
|
|
|
121 |
% Copyright (C) 2001 Arnaud Delorme and Scott Makeig, Salk Institute, |
|
|
122 |
% arno@salk.edu, smakeig@ucsd.edu. |
|
|
123 |
% |
|
|
124 |
% Copyright (C) 2001 Arnaud Delorme, SCCN/INC/UCSD, arno@salk.edu |
|
|
125 |
% |
|
|
126 |
% This file is part of EEGLAB, see http://www.eeglab.org |
|
|
127 |
% for the documentation and details. |
|
|
128 |
% |
|
|
129 |
% Redistribution and use in source and binary forms, with or without |
|
|
130 |
% modification, are permitted provided that the following conditions are met: |
|
|
131 |
% |
|
|
132 |
% 1. Redistributions of source code must retain the above copyright notice, |
|
|
133 |
% this list of conditions and the following disclaimer. |
|
|
134 |
% |
|
|
135 |
% 2. Redistributions in binary form must reproduce the above copyright notice, |
|
|
136 |
% this list of conditions and the following disclaimer in the documentation |
|
|
137 |
% and/or other materials provided with the distribution. |
|
|
138 |
% |
|
|
139 |
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
|
140 |
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
|
141 |
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
|
142 |
% ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
|
|
143 |
% LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
|
144 |
% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
|
145 |
% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
|
146 |
% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
|
147 |
% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
|
148 |
% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
|
|
149 |
% THE POSSIBILITY OF SUCH DAMAGE. |
|
|
150 |
|
|
|
151 |
function varargout = eeglab( onearg ) |
|
|
152 |
|
|
|
153 |
persistent warningShowed; |
|
|
154 |
|
|
|
155 |
ver = version; |
|
|
156 |
if strcmpi(ver, '9.4.0.813654 (R2018a)') |
|
|
157 |
disp('Link to install <a href="https://www.mathworks.com/downloads/web_downloads/download_update?release=R2018a&s_tid=ebrg_R2018a_2_1757132">2018a Update 2</a>'); |
|
|
158 |
errordlg( [ 'You are running Matlab version R2018a, which has important bugs' 10 'Matlab crashes when running EEGLAB in this version of Matlab' 10 'Install 2018a Update 2 to fix the issue (link on the command line)' ]); |
|
|
159 |
end |
|
|
160 |
|
|
|
161 |
if nargout > 0 |
|
|
162 |
varargout = { [] [] 0 {} [] }; |
|
|
163 |
end |
|
|
164 |
|
|
|
165 |
% Warning if in toolbox folder |
|
|
166 |
% ---------------------------- |
|
|
167 |
if isempty(warningShowed) |
|
|
168 |
filterPath = fileparts(fileparts(fileparts(which('filter')))); |
|
|
169 |
eeglabPath = fileparts(fileparts(which('eeglab'))); |
|
|
170 |
if ~isempty(strfind(filterPath, eeglabPath)) |
|
|
171 |
fprintf(2, 'Warning: Either you added the EEGLAB path with subfolders or the EEGLAB path is in the MATLAB toolbox\n'); |
|
|
172 |
fprintf(2, ' folder which is not recommended. You may experience errors if a plugin overloads a MATLAB function.\n'); |
|
|
173 |
fprintf(2, ' If you have added path with subfolders, remove all the EEGLAB path except the root EEGLAB path. \n'); |
|
|
174 |
fprintf(2, ' If EEGLAB is in the toolbox software, move it somewhere else. Then restart MATLAB and EEGLAB. \n'); |
|
|
175 |
fprintf(2, '\n'); |
|
|
176 |
end |
|
|
177 |
warningShowed = true; |
|
|
178 |
end |
|
|
179 |
|
|
|
180 |
% check Matlab version |
|
|
181 |
% -------------------- |
|
|
182 |
vers = version; |
|
|
183 |
vers = version; |
|
|
184 |
indp = find(vers == '.'); |
|
|
185 |
if str2num(vers(indp(1)+1)) > 1, vers = [ vers(1:indp(1)) '0' vers(indp(1)+1:end) ]; end |
|
|
186 |
indp = find(vers == '.'); |
|
|
187 |
vers = str2num(vers(1:indp(2)-1)); |
|
|
188 |
tmpv = which('version'); |
|
|
189 |
if ~isempty(findstr(lower(tmpv), 'biosig')) |
|
|
190 |
[tmpp, ~] = fileparts(tmpv); |
|
|
191 |
rmpath(tmpp); |
|
|
192 |
end |
|
|
193 |
% remove freemat folder if it exist |
|
|
194 |
tmpPath = fileparts(fileparts(which('sread'))); |
|
|
195 |
newPath = fullfile(tmpPath, 'maybe-missing', 'freemat3.5'); |
|
|
196 |
if exist(newPath) == 7 |
|
|
197 |
warning('off', 'MATLAB:rmpath:DirNotFound'); |
|
|
198 |
rmpath(newPath) |
|
|
199 |
warning('on', 'MATLAB:rmpath:DirNotFound'); |
|
|
200 |
end |
|
|
201 |
if ismatlab && vers < 7 |
|
|
202 |
tmpWarning = warning('query', 'backtrace'); |
|
|
203 |
warning('off', 'backtrace'); |
|
|
204 |
warning('This Matlab version is too old to run the current EEGLAB'); |
|
|
205 |
warning('Download EEGLAB 4.3b at http://sccn.ucsd.edu/eeglab/eeglab4.5b.teaching.zip'); |
|
|
206 |
warning('This version of EEGLAB is compatible with all Matlab version down to Matlab 5.3'); |
|
|
207 |
warning(tmpWarning.state, 'backtrace'); |
|
|
208 |
return; |
|
|
209 |
end |
|
|
210 |
if ismatlab && vers < 7.06 |
|
|
211 |
tmpWarning = warning('query','backtrace'); |
|
|
212 |
warning off backtrace; |
|
|
213 |
warning('You are using a Matlab version older than 7.6 (2008a)'); |
|
|
214 |
warning('Some of the EEGLAB functions might not be functional'); |
|
|
215 |
warning('Download EEGLAB 4.3b at http://sccn.ucsd.edu/eeglab/eeglab4.5b.teaching.zip'); |
|
|
216 |
warning('This version of EEGLAB is compatible with all Matlab version down to Matlab 5.3'); |
|
|
217 |
warning( tmpWarning.state, 'backtrace'); |
|
|
218 |
end |
|
|
219 |
if ~ismatlab |
|
|
220 |
warning('off', 'Octave:abbreviated-property-match'); |
|
|
221 |
warning('off', 'Octave:legacy-function'); |
|
|
222 |
warning('off', 'Octave:num-to-str'); |
|
|
223 |
warning('off', 'backtrace'); |
|
|
224 |
warning('off', 'Octave:divide-by-zero'); |
|
|
225 |
try |
|
|
226 |
pkg load statistics |
|
|
227 |
catch |
|
|
228 |
warning('Statistics module not found - type "pkg install -forge io" then "pkg install -forge statistics" to install it'); |
|
|
229 |
end |
|
|
230 |
try |
|
|
231 |
pkg load signal |
|
|
232 |
catch |
|
|
233 |
warning('Signal processing module not found - type "pkg install -forge control" then "pkg install -forge signal" to install it'); |
|
|
234 |
end |
|
|
235 |
end |
|
|
236 |
|
|
|
237 |
% check potential issues with strjoin |
|
|
238 |
% ----------------------------------- |
|
|
239 |
strjoinPath = fileparts(which('strjoin')); |
|
|
240 |
[~,strjoinPath2] = fileparts(strjoinPath); |
|
|
241 |
if ~strcmpi(strjoinPath2, 'strfun') |
|
|
242 |
warning(sprintf('Potential function conflict for strjoin.m located in "%s" \nWe suggest removing the path from MATLAB to avoid problems.', strjoinPath)); |
|
|
243 |
end |
|
|
244 |
|
|
|
245 |
% check for duplicate versions of EEGLAB |
|
|
246 |
% -------------------------------------- |
|
|
247 |
eeglabpath = mywhich('eeglab.m'); |
|
|
248 |
eeglabpath = eeglabpath(1:end-length('eeglab.m')); |
|
|
249 |
if nargin < 1 && ~isdeployed |
|
|
250 |
eeglabpath2 = ''; |
|
|
251 |
if strcmpi(eeglabpath, pwd) || strcmpi(eeglabpath(1:end-1), pwd) |
|
|
252 |
cd('functions'); |
|
|
253 |
warning('off', 'MATLAB:rmpath:DirNotFound'); |
|
|
254 |
rmpath(eeglabpath); |
|
|
255 |
warning('on', 'MATLAB:rmpath:DirNotFound'); |
|
|
256 |
eeglabpath2 = mywhich('eeglab.m'); |
|
|
257 |
cd('..'); |
|
|
258 |
else |
|
|
259 |
try rmpath(eeglabpath); catch, end |
|
|
260 |
eeglabpath2 = mywhich('eeglab.m'); |
|
|
261 |
end |
|
|
262 |
if ~isempty(eeglabpath2) |
|
|
263 |
eeglabpath2 = eeglabpath2(1:end-length('eeglab.m')); |
|
|
264 |
tmpWarning = warning('query', 'backtrace'); |
|
|
265 |
warning off backtrace; |
|
|
266 |
disp('******************************************************'); |
|
|
267 |
warning('There are at least two versions of EEGLAB in your path'); |
|
|
268 |
warning(sprintf('One is at %s', eeglabpath)); |
|
|
269 |
warning(sprintf('The other one is at %s', eeglabpath2)); |
|
|
270 |
warning(tmpWarning.state, 'backtrace'); |
|
|
271 |
end |
|
|
272 |
addpath(eeglabpath); |
|
|
273 |
end |
|
|
274 |
|
|
|
275 |
% add the paths |
|
|
276 |
% ------------- |
|
|
277 |
if strcmpi(eeglabpath, './') || strcmpi(eeglabpath, '.\'), eeglabpath = [ pwd filesep ]; end |
|
|
278 |
|
|
|
279 |
% solve BIOSIG problem |
|
|
280 |
% -------------------- |
|
|
281 |
pathtmp = mywhich('wilcoxon_test'); |
|
|
282 |
if ~isempty(pathtmp) |
|
|
283 |
try |
|
|
284 |
rmpath(pathtmp(1:end-15)); |
|
|
285 |
catch, end |
|
|
286 |
end |
|
|
287 |
|
|
|
288 |
% test for local SCCN copy |
|
|
289 |
% ------------------------ |
|
|
290 |
if ~isdeployed |
|
|
291 |
addpathifnotinlist(eeglabpath); |
|
|
292 |
if exist( fullfile( eeglabpath, 'functions', 'adminfunc') ) ~= 7 |
|
|
293 |
warning('EEGLAB subfolders not found'); |
|
|
294 |
end |
|
|
295 |
end |
|
|
296 |
|
|
|
297 |
% determine file format |
|
|
298 |
% --------------------- |
|
|
299 |
fileformat = 'maclinux'; |
|
|
300 |
comp = computer; |
|
|
301 |
try |
|
|
302 |
if strcmpi(comp(1:3), 'GLN') || strcmpi(comp(1:3), 'MAC') || strcmpi(comp(1:3), 'SOL') |
|
|
303 |
fileformat = 'maclinux'; |
|
|
304 |
elseif strcmpi(comp(1:5), 'pcwin') |
|
|
305 |
fileformat = 'pcwin'; |
|
|
306 |
end |
|
|
307 |
end |
|
|
308 |
|
|
|
309 |
% add paths |
|
|
310 |
% --------- |
|
|
311 |
if ~isdeployed |
|
|
312 |
tmp = which('eeglab_data.set'); |
|
|
313 |
if ~isempty(which('eeglab_data.set')) && ~isempty(which('Standard-10-10-Cap47.ced')) |
|
|
314 |
tmpWarning = warning('query', 'backtrace'); |
|
|
315 |
warning off backtrace; |
|
|
316 |
warning(sprintf([ '\n\nPath Warning: It appears that you have added the path to all of the\n' ... |
|
|
317 |
'subfolders to EEGLAB. This may create issues with some EEGLAB extensions\n' ... |
|
|
318 |
'If EEGLAB cannot start or your experience a large number of warning\n' ... |
|
|
319 |
'messages, remove all the EEGLAB paths then go to the EEGLAB folder\n' ... |
|
|
320 |
'and start EEGLAB which will add all the necessary paths.\n\n' ])); |
|
|
321 |
warning(tmpWarning.state, 'backtrace'); |
|
|
322 |
foldertorm = fileparts(which('fgetl.m')); |
|
|
323 |
if ~isempty(strfind(foldertorm, 'eeglab')) |
|
|
324 |
rmpath(foldertorm); |
|
|
325 |
end |
|
|
326 |
foldertorm = fileparts(which('strjoin.m')); |
|
|
327 |
if ~isempty(strfind(foldertorm, 'eeglab')) |
|
|
328 |
rmpath(foldertorm); |
|
|
329 |
end |
|
|
330 |
end |
|
|
331 |
myaddpath( eeglabpath, 'eeg_checkset.m', [ 'functions' filesep 'adminfunc' ]); |
|
|
332 |
myaddpath( eeglabpath, 'eeg_checkset.m', [ 'functions' filesep 'adminfunc' ]); |
|
|
333 |
myaddpath( eeglabpath, ['@mmo' filesep 'mmo.m'], 'functions'); |
|
|
334 |
myaddpath( eeglabpath, 'readeetraklocs.m', [ 'functions' filesep 'sigprocfunc' ]); |
|
|
335 |
myaddpath( eeglabpath, 'supergui.m', [ 'functions' filesep 'guifunc' ]); |
|
|
336 |
myaddpath( eeglabpath, 'pop_study.m', [ 'functions' filesep 'studyfunc' ]); |
|
|
337 |
myaddpath( eeglabpath, 'eeglab_data.set', [ 'sample_data' ]); |
|
|
338 |
myaddpath( eeglabpath, 'mheadnew.mat', [ 'functions' filesep 'supportfiles' ]); |
|
|
339 |
myaddpath( eeglabpath, 'pop_loadbci.m', [ 'functions' filesep 'popfunc' ]); |
|
|
340 |
myaddpath( eeglabpath, 'statcond.m', [ 'functions' filesep 'statistics' ]); |
|
|
341 |
myaddpath( eeglabpath, 'timefreq.m', [ 'functions' filesep 'timefreqfunc' ]); |
|
|
342 |
myaddpath( eeglabpath, 'icademo.m', [ 'functions' filesep 'miscfunc' ]); |
|
|
343 |
myaddpath( eeglabpath, 'eeglab1020.ced', [ 'functions' filesep 'supportfiles' ]); |
|
|
344 |
addpathifnotinlist(fullfile(eeglabpath, 'plugins')); |
|
|
345 |
eeglab_options; |
|
|
346 |
|
|
|
347 |
% remove path to to fmrlab if neceecessary |
|
|
348 |
path_runica = fileparts(mywhich('runica')); |
|
|
349 |
if length(path_runica) > 6 && strcmpi(path_runica(end-5:end), 'fmrlab') |
|
|
350 |
rmpath(path_runica); |
|
|
351 |
end |
|
|
352 |
|
|
|
353 |
% add path if toolboxes are missing |
|
|
354 |
% --------------------------------- |
|
|
355 |
if option_donotusetoolboxes |
|
|
356 |
p1 = fileparts(mywhich('ttest')); |
|
|
357 |
p2 = fileparts(mywhich('filtfilt')); |
|
|
358 |
p3 = fileparts(mywhich('optimtool')); |
|
|
359 |
p4 = fileparts(mywhich('gray2ind')); |
|
|
360 |
if ~isempty(p1), rmpath(p1); end |
|
|
361 |
if ~isempty(p2), rmpath(p2); end |
|
|
362 |
if ~isempty(p3), rmpath(p3); end |
|
|
363 |
if ~isempty(p4), rmpath(p4); end |
|
|
364 |
end |
|
|
365 |
|
|
|
366 |
% remove BIOSIG path which are not needed and might cause conflicts |
|
|
367 |
biosigp{1} = fileparts(which('sopen.m')); |
|
|
368 |
biosigp{2} = fileparts(which('regress_eog.m')); |
|
|
369 |
biosigp{3} = fileparts(which('DecimalFactors.txt')); |
|
|
370 |
removepath(fileparts(fileparts(biosigp{1})), biosigp{:}) |
|
|
371 |
else |
|
|
372 |
eeglab_options; |
|
|
373 |
end |
|
|
374 |
|
|
|
375 |
% declare the variables as global |
|
|
376 |
evalin('base', 'eeg_global;'); |
|
|
377 |
eeg_global; |
|
|
378 |
|
|
|
379 |
% remove empty datasets in ALLEEG |
|
|
380 |
while ~isempty(ALLEEG) && isempty(ALLEEG(end).data) |
|
|
381 |
ALLEEG(end) = []; |
|
|
382 |
end |
|
|
383 |
if isempty(CURRENTSET) |
|
|
384 |
if isequal(CURRENTSTUDY, 0) |
|
|
385 |
CURRENTSET = 1; |
|
|
386 |
else |
|
|
387 |
CURRENTSET = 1:length(ALLEEG); |
|
|
388 |
end |
|
|
389 |
end |
|
|
390 |
if ~isempty(ALLEEG) && max(CURRENTSET) > length(ALLEEG) |
|
|
391 |
CURRENTSET = 1; |
|
|
392 |
EEG = eeg_retrieve(ALLEEG, CURRENTSET); |
|
|
393 |
end |
|
|
394 |
|
|
|
395 |
% for the history function |
|
|
396 |
% ------------------------ |
|
|
397 |
comtmp = 'warning off MATLAB:mir_warning_variable_used_as_function'; |
|
|
398 |
evalin('base' , comtmp, ''); |
|
|
399 |
evalin('caller', comtmp, ''); |
|
|
400 |
|
|
|
401 |
evalin('base', 'eeg_global;'); |
|
|
402 |
if nargin < 1 || exist('EEG') ~= 1 |
|
|
403 |
EEG = []; |
|
|
404 |
ALLEEG = []; |
|
|
405 |
CURRENTSET = []; |
|
|
406 |
ALLCOM = []; |
|
|
407 |
LASTCOM = []; |
|
|
408 |
STUDY =[]; |
|
|
409 |
CURRENTSTUDY = 0; |
|
|
410 |
EEG = eeg_emptyset; |
|
|
411 |
eegh('[ALLEEG EEG CURRENTSET ALLCOM] = eeglab;'); |
|
|
412 |
if ismatlab && get(0, 'screendepth') <= 8 |
|
|
413 |
disp('Warning: screen color depth too low, some colors will be inaccurate in time-frequency plots'); |
|
|
414 |
end |
|
|
415 |
end |
|
|
416 |
if isempty(CURRENTSTUDY) CURRENTSTUDY = 0; end |
|
|
417 |
|
|
|
418 |
nouiflag = false; |
|
|
419 |
versL = ~option_allmenus; |
|
|
420 |
if nargin == 1 |
|
|
421 |
if strcmp(onearg, 'versions') |
|
|
422 |
disp( [ 'EEGLAB v' eeg_getversion ] ); |
|
|
423 |
elseif strcmp(onearg, 'nogui') |
|
|
424 |
nouiflag = true; |
|
|
425 |
if nargout < 1, clear ALLEEG; end % do not return output var |
|
|
426 |
elseif strcmp(onearg, 'redraw') |
|
|
427 |
W_MAIN = findobj('tag', 'EEGLAB'); |
|
|
428 |
if ~isempty(W_MAIN) |
|
|
429 |
updatemenu; |
|
|
430 |
if nargout < 1, clear ALLEEG; end % do not return output var |
|
|
431 |
return; |
|
|
432 |
else |
|
|
433 |
eegh('eeglab(''redraw'');'); |
|
|
434 |
end |
|
|
435 |
elseif strcmpi(onearg, 'continuous') || strcmpi(onearg, 'cont') |
|
|
436 |
ALLEEG = []; CURRENTSET = 0; CURRENTSTUDY = 0; STUDY = []; |
|
|
437 |
disp('Clearing all data and loading tutorial continuous data') |
|
|
438 |
EEG = pop_loadset(fullfile(eeglabpath, 'sample_data', 'eeglab_data.set')); |
|
|
439 |
[ALLEEG, EEG, CURRENTSET] = eeg_store(ALLEEG, EEG, 0); |
|
|
440 |
eeglab redraw; |
|
|
441 |
return |
|
|
442 |
elseif strcmp(onearg, 'epoch') |
|
|
443 |
ALLEEG = []; CURRENTSET = 0; CURRENTSTUDY = 0; STUDY = []; |
|
|
444 |
disp('Clearing all data and loading tutorial epoched data') |
|
|
445 |
EEG = pop_loadset(fullfile(eeglabpath, 'sample_data', 'eeglab_data_epochs_ica.set')); |
|
|
446 |
[ALLEEG, EEG, CURRENTSET] = eeg_store(ALLEEG, EEG, 0); |
|
|
447 |
eeglab redraw; |
|
|
448 |
return |
|
|
449 |
elseif strcmp(onearg, 'study') |
|
|
450 |
ALLEEG = []; CURRENTSET = 0; CURRENTSTUDY = 0; STUDY = []; |
|
|
451 |
disp('Clearing all data and loading tutorial study') |
|
|
452 |
[STUDY, ALLEEG] = pop_loadstudy('filename', 'stern3s.study', 'filepath', '/System/Volumes/Data/data/data/STUDIES/STERN_test_1file_per_subject'); |
|
|
453 |
EEG = ALLEEG; CURRENTSET = 1:length(EEG); CURRENTSTUDY = 1; |
|
|
454 |
eeglab redraw; |
|
|
455 |
return |
|
|
456 |
elseif strcmp(onearg, 'rebuild') |
|
|
457 |
W_MAIN = findobj('tag', 'EEGLAB'); |
|
|
458 |
close(W_MAIN); |
|
|
459 |
eeglab redraw; |
|
|
460 |
return; |
|
|
461 |
elseif strcmp(onearg, 'full') |
|
|
462 |
versL = false; |
|
|
463 |
else |
|
|
464 |
if ~exist(onearg, 'file') && ~any(onearg == ';') |
|
|
465 |
fprintf(2,['EEGLAB Warning: Invalid argument ''' onearg '''. Restarting EEGLAB interface instead.\n']); |
|
|
466 |
eegh('[ALLEEG EEG CURRENTSET ALLCOM] = eeglab(''rebuild'');'); |
|
|
467 |
else |
|
|
468 |
nouiflag = true; |
|
|
469 |
end |
|
|
470 |
end |
|
|
471 |
else |
|
|
472 |
onearg = 'rebuild'; |
|
|
473 |
end |
|
|
474 |
ALLCOM = ALLCOM; |
|
|
475 |
try, colordef('white'); catch end % removed from MATLAB |
|
|
476 |
if versL && ~nouiflag |
|
|
477 |
disp('Some menu items hidden. Use Preference menu to show them all.'); |
|
|
478 |
end |
|
|
479 |
|
|
|
480 |
% default option folder |
|
|
481 |
% --------------------- |
|
|
482 |
if ~isdeployed |
|
|
483 |
eeglab_options; |
|
|
484 |
fprintf('eeglab: options file is %s%seeg_options.m\n', homefolder, filesep); |
|
|
485 |
end |
|
|
486 |
|
|
|
487 |
% checking strings |
|
|
488 |
% ---------------- |
|
|
489 |
e_try = 'try,'; |
|
|
490 |
e_catch = 'catch, eeglab_error; LASTCOM= ''''; clear EEGTMP ALLEEGTMP STUDYTMP; end;'; |
|
|
491 |
nocheck = e_try; |
|
|
492 |
ret = 'if ~isempty(LASTCOM), if LASTCOM(1) == -1, LASTCOM = ''''; return; end; end;'; |
|
|
493 |
check = ['[EEG LASTCOM] = eeg_checkset(EEG, ''data'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
494 |
checkcont = ['[EEG LASTCOM] = eeg_checkset(EEG, ''contdata'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
495 |
checkica = ['[EEG LASTCOM] = eeg_checkset(EEG, ''ica'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
496 |
checkepoch = ['[EEG LASTCOM] = eeg_checkset(EEG, ''epoch'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
497 |
checkevent = ['[EEG LASTCOM] = eeg_checkset(EEG, ''event'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
498 |
checkbesa = ['[EEG LASTCOM] = eeg_checkset(EEG, ''besa'');' ret ' eegh(''% no history yet for BESA dipole localization'');' e_try]; |
|
|
499 |
checkepochica = ['[EEG LASTCOM] = eeg_checkset(EEG, ''epoch'', ''ica'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
500 |
checkplot = ['[EEG LASTCOM] = eeg_checkset(EEG, ''chanloc'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
501 |
checkicaplot = ['[EEG LASTCOM] = eeg_checkset(EEG, ''ica'', ''chanloc'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
502 |
checkepochplot = ['[EEG LASTCOM] = eeg_checkset(EEG, ''epoch'', ''chanloc'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
503 |
checkepochicaplot = ['[EEG LASTCOM] = eeg_checkset(EEG, ''epoch'', ''ica'', ''chanloc'');' ret ' eegh(LASTCOM);' e_try]; |
|
|
504 |
|
|
|
505 |
% check string and backup old dataset |
|
|
506 |
% ----------------------------------- |
|
|
507 |
backup = [ 'if CURRENTSET ~= 0,' ... |
|
|
508 |
' [ ALLEEG EEG ] = eeg_store(ALLEEG, EEG, CURRENTSET, ''savegui'');' ... |
|
|
509 |
' eegh(''[ALLEEG EEG] = eeg_store(ALLEEG, EEG, CURRENTSET, ''''savedata'''');'');' ... |
|
|
510 |
'end;' ]; |
|
|
511 |
|
|
|
512 |
storenewcall = 'EEG = eegh(LASTCOM, EEG); [ALLEEG EEG CURRENTSET LASTCOM] = pop_newset(ALLEEG, EEG, CURRENTSET, ''study'', ~isempty(STUDY)+0); eegh(LASTCOM);'; |
|
|
513 |
storecall = 'EEG = eegh(LASTCOM, EEG); [ALLEEG, EEG] = eeg_store(ALLEEG, EEG, CURRENTSET); eegh(''[ALLEEG, EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);'');'; |
|
|
514 |
storecall = 'EEG = eegh(LASTCOM, EEG); [ALLEEG, EEG] = eeg_store(ALLEEG, EEG, CURRENTSET);'; |
|
|
515 |
testeegtmp = 'if exist(''EEGTMP'') == 1, EEG = EEGTMP; clear EEGTMP; end;'; % for backward compatibility |
|
|
516 |
ifeeg = 'if ~isempty(LASTCOM) && ~isempty(EEG),'; |
|
|
517 |
|
|
|
518 |
% nh = no dataset history |
|
|
519 |
% ----------------------- |
|
|
520 |
e_hist_noeegh = [e_catch 'eegh(LASTCOM);']; |
|
|
521 |
|
|
|
522 |
% study checking |
|
|
523 |
% -------------- |
|
|
524 |
e_check_study = 'if length(EEG) > 1 && CURRENTSTUDY == 1, STUDY = std_checkset(STUDY, ALLEEG); eegh(''STUDY = std_checkset(STUDY, ALLEEG);''); end;'; |
|
|
525 |
e_load_study = [e_catch 'if ~isempty(LASTCOM), STUDY = STUDYTMP; STUDY = eegh(LASTCOM, STUDY); ALLEEG = ALLEEGTMP; EEG = ALLEEG; CURRENTSET = [1:length(EEG)]; eegh(''CURRENTSTUDY = 1; EEG = ALLEEG; CURRENTSET = [1:length(EEG)];''); CURRENTSTUDY = 1; disp(''Done.''); end; clear ALLEEGTMP STUDYTMP; eeglab(''redraw'');']; |
|
|
526 |
e_plot_study = [e_catch 'if ~isempty(LASTCOM), STUDY = STUDYTMP; STUDY = eegh(LASTCOM, STUDY); disp(''Done.''); end; clear ALLEEGTMP STUDYTMP; eeglab(''redraw'');']; % ALLEEG not modified |
|
|
527 |
|
|
|
528 |
% same as above but also save history in dataset |
|
|
529 |
% ---------------------------------------------- |
|
|
530 |
e_newset = [e_catch testeegtmp 'eeglab_new;' e_check_study ]; |
|
|
531 |
e_store = [e_catch 'eeglab_new;' ]; |
|
|
532 |
e_hist = [e_catch 'eeglab_new;' ]; |
|
|
533 |
e_histdone = [e_catch 'eeglab_new; disp(''done'');' ]; |
|
|
534 |
|
|
|
535 |
% build structures for plugins |
|
|
536 |
% ---------------------------- |
|
|
537 |
trystrs.no_check = e_try; |
|
|
538 |
trystrs.check_data = check; |
|
|
539 |
trystrs.check_ica = checkica; |
|
|
540 |
trystrs.check_cont = checkcont; |
|
|
541 |
trystrs.check_epoch = checkepoch; |
|
|
542 |
trystrs.check_event = checkevent; |
|
|
543 |
trystrs.check_epoch_ica = checkepochica; |
|
|
544 |
trystrs.check_chanlocs = checkplot; |
|
|
545 |
trystrs.check_epoch_chanlocs = checkepochplot; |
|
|
546 |
trystrs.check_epoch_ica_chanlocs = checkepochicaplot; |
|
|
547 |
trystrs.check_ica_chanlocs = checkicaplot; |
|
|
548 |
catchstrs.add_to_hist = e_store; |
|
|
549 |
catchstrs.store_and_hist = e_store; |
|
|
550 |
catchstrs.new_and_hist = e_newset; |
|
|
551 |
catchstrs.new_non_empty = e_newset; |
|
|
552 |
catchstrs.update_study = e_plot_study; |
|
|
553 |
catchstrs.load_study = e_load_study; |
|
|
554 |
|
|
|
555 |
% create eeglab figure |
|
|
556 |
% -------------------- |
|
|
557 |
if ~nouiflag |
|
|
558 |
eeg_mainfig(onearg); |
|
|
559 |
end |
|
|
560 |
|
|
|
561 |
% detecting icalab |
|
|
562 |
% ---------------- |
|
|
563 |
if exist('icalab') |
|
|
564 |
disp('ICALAB toolbox detected (algo. added to "run ICA" interface)'); |
|
|
565 |
end |
|
|
566 |
|
|
|
567 |
if ~isdeployed |
|
|
568 |
% check for older version of Fieldtrip and presence of topoplot |
|
|
569 |
% ------------------------------------------------------------- |
|
|
570 |
ptopoplot = fileparts(mywhich('cbar')); |
|
|
571 |
ptopoplot2 = fileparts(mywhich('topoplot')); |
|
|
572 |
if ~strcmpi(ptopoplot, ptopoplot2) |
|
|
573 |
%disp(' Warning: duplicate function topoplot.m in Fieldtrip and EEGLAB'); |
|
|
574 |
%disp(' EEGLAB function will prevail and call the Fieldtrip one when appropriate'); |
|
|
575 |
addpath(ptopoplot); |
|
|
576 |
end |
|
|
577 |
pcheck = fileparts(mywhich('finputcheck')); |
|
|
578 |
if ~strfind(pcheck, 'guifunc') |
|
|
579 |
rmpath(fileparts(pcheck)); |
|
|
580 |
end |
|
|
581 |
end |
|
|
582 |
|
|
|
583 |
cb_importdata = [ nocheck '[EEG LASTCOM] = pop_importdata;' e_newset ]; |
|
|
584 |
cb_biosig = [ nocheck '[EEG LASTCOM] = pop_biosig; ' e_newset ]; |
|
|
585 |
cb_fileio = [ nocheck '[EEG LASTCOM] = pop_fileio; ' e_newset ]; |
|
|
586 |
|
|
|
587 |
cb_importepoch = [ checkepoch '[EEG LASTCOM] = pop_importepoch(EEG);' e_store ]; |
|
|
588 |
cb_importevent = [ check '[EEG LASTCOM] = pop_importevent(EEG);' e_store ]; |
|
|
589 |
cb_chanevent = [ check '[EEG LASTCOM]= pop_chanevent(EEG);' e_store ]; |
|
|
590 |
cb_importpres = [ check '[EEG LASTCOM]= pop_importpres(EEG);' e_store ]; |
|
|
591 |
cb_importerplab= [ check '[EEG LASTCOM]= pop_importerplab(EEG);' e_store ]; |
|
|
592 |
cb_export = [ check 'LASTCOM = pop_export(EEG);' e_histdone ]; |
|
|
593 |
cb_expica1 = [ check 'LASTCOM = pop_expica(EEG, ''weights'');' e_histdone ]; |
|
|
594 |
cb_expica2 = [ check 'LASTCOM = pop_expica(EEG, ''inv'');' e_histdone ]; |
|
|
595 |
cb_expevents = [ check 'LASTCOM = pop_expevents(EEG);' e_histdone ]; |
|
|
596 |
cb_expdata = [ check 'LASTCOM = pop_writeeeg(EEG);' e_histdone ]; |
|
|
597 |
|
|
|
598 |
cb_loadset = [ nocheck '[EEG LASTCOM] = pop_loadset;' e_newset]; |
|
|
599 |
cb_saveset = [ check '[EEG LASTCOM] = pop_saveset(EEG, ''savemode'', ''resave'');' e_store ]; |
|
|
600 |
cb_savesetas = [ check '[EEG LASTCOM] = pop_saveset(EEG);' e_store ]; |
|
|
601 |
cb_delset = [ nocheck '[ALLEEG LASTCOM] = pop_delset(ALLEEG, -CURRENTSET);' e_hist_noeegh 'eeglab redraw;' ]; |
|
|
602 |
cb_study1 = [ nocheck 'pop_stdwarn; [STUDYTMP ALLEEGTMP LASTCOM] = pop_study([], ALLEEG , ''gui'', ''on'');' e_load_study]; |
|
|
603 |
cb_study2 = [ nocheck 'pop_stdwarn; [STUDYTMP ALLEEGTMP LASTCOM] = pop_studywizard;' e_load_study]; |
|
|
604 |
cb_studyerp = [ nocheck 'pop_stdwarn; [STUDYTMP ALLEEGTMP LASTCOM] = pop_studyerp;' e_load_study]; |
|
|
605 |
cb_loadstudy = [ nocheck 'pop_stdwarn; [STUDYTMP ALLEEGTMP LASTCOM] = pop_loadstudy; if ~isempty(LASTCOM), STUDYTMP = std_renamestudyfiles(STUDYTMP, ALLEEGTMP); end;' e_load_study]; |
|
|
606 |
cb_savestudy1 = [ check '[STUDYTMP ALLEEGTMP LASTCOM] = pop_savestudy(STUDY, EEG, ''savemode'', ''resavegui'');' e_load_study]; |
|
|
607 |
cb_savestudy2 = [ check '[STUDYTMP ALLEEGTMP LASTCOM] = pop_savestudy(STUDY, EEG);' e_load_study]; |
|
|
608 |
cb_clearstudy = 'LASTCOM = ''STUDY = []; CURRENTSTUDY = 0; ALLEEG = []; EEG=[]; CURRENTSET=[];''; eval(LASTCOM); eegh( LASTCOM ); eeglab redraw;'; |
|
|
609 |
cb_editoptions = [ nocheck 'if isfield(ALLEEG, ''nbchan''), LASTCOM = pop_editoptions(length([ ALLEEG.nbchan ]) >1);' ... |
|
|
610 |
'else LASTCOM = pop_editoptions(0); end;' e_hist_noeegh ]; |
|
|
611 |
cb_plugin = [ nocheck 'if plugin_menu(PLUGINLIST) , close(findobj(''tag'', ''EEGLAB'')); eeglab redraw; end;' e_hist_noeegh ]; |
|
|
612 |
|
|
|
613 |
cb_saveh1 = [ nocheck 'LASTCOM = pop_saveh(EEG.history);' e_hist_noeegh]; |
|
|
614 |
cb_saveh2 = [ nocheck 'LASTCOM = pop_saveh(ALLCOM);' e_hist_noeegh]; |
|
|
615 |
cb_runsc = [ nocheck 'LASTCOM = pop_runscript;' e_hist ]; |
|
|
616 |
cb_quit = [ 'close(gcf); disp(''To save the EEGLAB command history >> pop_saveh(ALLCOM);'');' ... |
|
|
617 |
'clear global EEG ALLEEG LASTCOM CURRENTSET;']; |
|
|
618 |
|
|
|
619 |
cb_editset = [ check '[EEG LASTCOM] = pop_editset(EEG);' e_store]; |
|
|
620 |
cb_editeventf = [ checkevent '[EEG LASTCOM] = pop_editeventfield(EEG);' e_store]; |
|
|
621 |
cb_editeventv = [ checkevent '[EEG LASTCOM] = pop_editeventvals(EEG);' e_store]; |
|
|
622 |
cb_adjustevents= [ checkevent '[EEG LASTCOM] = pop_adjustevents(EEG);' e_store]; |
|
|
623 |
cb_comments = [ check '[EEG LASTCOM] =pop_comments(EEG, ''About this dataset'');' e_store]; |
|
|
624 |
cb_chanedit = [ check 'disp(''IMPORTANT: After importing/modifying data channels, you must close'');' ... |
|
|
625 |
'disp(''the channel editing window for the changes to take effect in EEGLAB.'');' ... |
|
|
626 |
'disp(''TIP: Call this function directly from the prompt, ">> pop_chanedit([]);"'');' ... |
|
|
627 |
'disp('' to convert between channel location file formats'');' ... |
|
|
628 |
'[EEG TMPINFO TMP LASTCOM] = pop_chanedit(EEG); clear TMPINFO TMP; if ~isempty(LASTCOM), EEG = eeg_checkset(EEG, ''chanlocsize''); end;' ... |
|
|
629 |
e_store ]; |
|
|
630 |
%'clear TMPINFO TMP; EEG = eegh(LASTCOM, EEG);' storecall 'end; eeglab(''redraw'');']; |
|
|
631 |
cb_select = [ check '[EEG LASTCOM] = pop_select(EEG);' e_newset]; |
|
|
632 |
cb_rmdat = [ checkevent '[EEG LASTCOM] = pop_rmdat(EEG);' e_newset]; |
|
|
633 |
cb_selectevent = [ checkevent '[EEG,~,LASTCOM] = pop_selectevent(EEG);' e_newset ]; |
|
|
634 |
cb_copyset = [ check '[ALLEEG EEG CURRENTSET LASTCOM] = pop_copyset(ALLEEG, CURRENTSET); eeglab(''redraw'');' e_hist_noeegh]; |
|
|
635 |
cb_mergeset = [ check '[EEG LASTCOM] = pop_mergeset(ALLEEG);' e_newset]; |
|
|
636 |
|
|
|
637 |
cb_resample = [ check '[EEG LASTCOM] = pop_resample(EEG);' e_newset]; |
|
|
638 |
cb_eegfilt = [ check '[EEG LASTCOM] = pop_eegfilt(EEG);' e_newset]; |
|
|
639 |
cb_interp = [ check '[EEG LASTCOM] = pop_interp(EEG); ' e_newset]; |
|
|
640 |
cb_reref = [ check '[EEG LASTCOM] = pop_reref(EEG);' e_newset]; |
|
|
641 |
cb_eegplot = [ check '[LASTCOM] = pop_eegplot(EEG, 1);' e_hist]; |
|
|
642 |
cb_epoch = [ check '[EEG,~,LASTCOM] = pop_epoch(EEG);' e_newset e_check_study ]; |
|
|
643 |
cb_rmbase = [ check '[EEG LASTCOM] = pop_rmbase(EEG);' e_newset e_check_study]; |
|
|
644 |
cb_runica = [ check '[EEG LASTCOM] = pop_runica(EEG);' e_store e_check_study]; |
|
|
645 |
cb_subcomp = [ checkica '[EEG LASTCOM] = pop_subcomp(EEG);' e_newset]; |
|
|
646 |
%cb_chanrej = [ check 'pop_rejchan(EEG); LASTCOM = '''';' e_hist]; |
|
|
647 |
cb_chanrej = [ check '[EEG, ~, ~, LASTCOM] = pop_rejchan(EEG);' e_hist]; |
|
|
648 |
cb_autorej = [ checkepoch '[EEG, ~, LASTCOM] = pop_autorej(EEG);' e_hist]; |
|
|
649 |
cb_rejcont = [ check '[EEG, ~, ~, LASTCOM] = pop_rejcont(EEG);' e_hist]; |
|
|
650 |
|
|
|
651 |
cb_rejmenu1 = [ check 'pop_rejmenu(EEG, 1); LASTCOM = '''';' e_hist]; |
|
|
652 |
cb_eegplotrej1 = [ check '[LASTCOM] = pop_eegplot(EEG, 1);' e_hist]; |
|
|
653 |
cb_eegthresh1 = [ checkepoch '[EEG,~,LASTCOM] = pop_eegthresh(EEG, 1);' e_hist]; |
|
|
654 |
cb_rejtrend1 = [ checkepoch '[EEG LASTCOM] = pop_rejtrend(EEG, 1);' e_store]; |
|
|
655 |
cb_jointprob1 = [ checkepoch '[EEG LASTCOM] = pop_jointprob(EEG, 1);' e_store]; |
|
|
656 |
cb_rejkurt1 = [ checkepoch '[EEG LASTCOM] = pop_rejkurt(EEG, 1);' e_store]; |
|
|
657 |
cb_rejspec1 = [ checkepoch '[EEG, ~, LASTCOM] = pop_rejspec(EEG, 1);' e_store]; |
|
|
658 |
cb_rejsup1 = [ checkepochica '[EEG LASTCOM] = eeg_rejsuperpose(EEG, 1,1,1,1,1,1,1,1); eegh(LASTCOM);' ... |
|
|
659 |
'LASTCOM = ''EEG.reject.icarejmanual = EEG.reject.rejglobal;''; eval(LASTCOM);' e_store ]; |
|
|
660 |
cb_rejsup2 = [ checkepoch '[EEG LASTCOM] = eeg_rejsuperpose(EEG, 1,1,1,1,1,1,1,1); EEG = eegh(LASTCOM, EEG);' ... |
|
|
661 |
'[EEG LASTCOM] = pop_rejepoch(EEG);' e_newset]; |
|
|
662 |
|
|
|
663 |
cb_selectcomps = [ checkicaplot '[EEG LASTCOM] = pop_selectcomps(EEG);' e_store]; |
|
|
664 |
cb_rejmenu2 = [ checkepochica 'pop_rejmenu(EEG, 0); LASTCOM ='''';' e_hist]; |
|
|
665 |
cb_eegplotrej2 = [ checkica '[LASTCOM] = pop_eegplot(EEG, 0);' e_hist]; |
|
|
666 |
cb_eegthresh2 = [ checkepochica '[TMP LASTCOM] = pop_eegthresh(EEG, 0); clear TMP;' e_hist]; |
|
|
667 |
cb_rejtrend2 = [ checkepochica '[EEG LASTCOM] = pop_rejtrend(EEG, 0);' e_store]; |
|
|
668 |
cb_jointprob2 = [ checkepochica '[EEG LASTCOM] = pop_jointprob(EEG, 0);' e_store]; |
|
|
669 |
cb_rejkurt2 = [ checkepochica '[EEG LASTCOM] = pop_rejkurt(EEG, 0);' e_store]; |
|
|
670 |
cb_rejspec2 = [ checkepochica '[EEG Itmp LASTCOM] = pop_rejspec(EEG, 1); clear Itmp;' e_store]; |
|
|
671 |
cb_rejsup3 = [ checkepochica '[EEG LASTCOM] = eeg_rejsuperpose(EEG, 0,1,1,1,1,1,1,1); eegh(LASTCOM);' ... |
|
|
672 |
'LASTCOM = ''EEG.reject.rejmanual = EEG.reject.rejglobal;''; eval(LASTCOM);' e_store ]; |
|
|
673 |
cb_rejsup4 = [ checkepochica '[EEG LASTCOM] = eeg_rejsuperpose(EEG, 0,1,1,1,1,1,1,1); EEG = eegh(LASTCOM, EEG);' ... |
|
|
674 |
'[EEG LASTCOM] = pop_rejepoch(EEG);' e_newset ]; |
|
|
675 |
|
|
|
676 |
cb_topoblank1 = [ checkplot 'LASTCOM = [''figure; topoplot([],EEG.chanlocs, ''''style'''', ''''blank'''', ' ... |
|
|
677 |
'''''electrodes'''', ''''labelpoint'''', ''''chaninfo'''', EEG.chaninfo);'']; eval(LASTCOM);' e_hist]; |
|
|
678 |
cb_topoblank2 = [ checkplot 'LASTCOM = [''figure; topoplot([],EEG.chanlocs, ''''style'''', ''''blank'''', ' ... |
|
|
679 |
'''''electrodes'''', ''''numpoint'''', ''''chaninfo'''', EEG.chaninfo);'']; eval(LASTCOM);' e_hist]; |
|
|
680 |
cb_eegplot1 = [ check 'LASTCOM = pop_eegplot(EEG, 1, 1, 1);' e_hist]; |
|
|
681 |
cb_spectopo1 = [ check 'LASTCOM = pop_spectopo(EEG, 1);' e_hist]; |
|
|
682 |
cb_prop1 = [ checkplot 'LASTCOM = pop_prop(EEG,1);' e_hist]; |
|
|
683 |
cb_erpimage1 = [ checkepoch 'LASTCOM = pop_erpimage(EEG, 1, eegh(''find'',''pop_erpimage(EEG,1''));' e_hist]; |
|
|
684 |
cb_timtopo = [ checkplot 'LASTCOM = pop_timtopo(EEG);' e_hist]; |
|
|
685 |
cb_plottopo = [ check 'LASTCOM = pop_plottopo(EEG);' e_hist]; |
|
|
686 |
cb_topoplot1 = [ checkplot 'LASTCOM = pop_topoplot(EEG, 1);' e_hist]; |
|
|
687 |
cb_headplot1 = [ checkplot '[EEG LASTCOM] = pop_headplot(EEG, 1);' e_store]; |
|
|
688 |
cb_comperp1 = [ checkepoch 'LASTCOM = pop_comperp(ALLEEG);' e_hist]; |
|
|
689 |
|
|
|
690 |
cb_eegplot2 = [ checkica '[LASTCOM] = pop_eegplot(EEG, 0, 1, 1);' e_hist]; |
|
|
691 |
cb_spectopo2 = [ checkicaplot 'LASTCOM = pop_spectopo(EEG, 0);' e_hist]; |
|
|
692 |
cb_topoplot2 = [ checkicaplot 'LASTCOM = pop_topoplot(EEG, 0);' e_hist]; |
|
|
693 |
cb_headplot2 = [ checkicaplot '[EEG LASTCOM] = pop_headplot(EEG, 0);' e_store]; |
|
|
694 |
cb_prop2 = [ checkicaplot 'LASTCOM = pop_prop(EEG,0);' e_hist]; |
|
|
695 |
cb_erpimage2 = [ checkepochica 'LASTCOM = pop_erpimage(EEG, 0, eegh(''find'',''pop_erpimage(EEG,0''));' e_hist]; |
|
|
696 |
cb_envtopo1 = [ checkicaplot 'LASTCOM = pop_envtopo(EEG);' e_hist]; |
|
|
697 |
cb_envtopo2 = [ checkicaplot 'if length(ALLEEG) == 1, error(''Need at least 2 datasets''); end; LASTCOM = pop_envtopo(ALLEEG);' e_hist]; |
|
|
698 |
cb_plotdata2 = [ checkepochica '[tmpeeg LASTCOM] = pop_plotdata(EEG, 0); clear tmpeeg;' e_hist]; |
|
|
699 |
cb_comperp2 = [ checkepochica 'LASTCOM = pop_comperp(ALLEEG, 0);' e_hist]; |
|
|
700 |
|
|
|
701 |
cb_signalstat1 = [ check 'LASTCOM = pop_signalstat(EEG, 1);' e_hist]; |
|
|
702 |
cb_signalstat2 = [ checkica 'LASTCOM = pop_signalstat(EEG, 0);' e_hist]; |
|
|
703 |
cb_eventstat = [ checkevent 'LASTCOM = pop_eventstat(EEG);' e_hist]; |
|
|
704 |
cb_timef1 = [ check 'LASTCOM = pop_newtimef(EEG, 1, eegh(''find'',''pop_newtimef(EEG,1''));' e_hist]; |
|
|
705 |
cb_crossf1 = [ check 'LASTCOM = pop_newcrossf(EEG, 1,eegh(''find'',''pop_newcrossf(EEG,1''));' e_hist]; |
|
|
706 |
cb_timef2 = [ checkica 'LASTCOM = pop_newtimef(EEG, 0, eegh(''find'',''pop_newtimef(EEG,0''));' e_hist]; |
|
|
707 |
cb_crossf2 = [ checkica 'LASTCOM = pop_newcrossf(EEG, 0,eegh(''find'',''pop_newcrossf(EEG,0''));' e_hist]; |
|
|
708 |
|
|
|
709 |
cb_study3 = [ nocheck '[STUDYTMP ALLEEGTMP LASTCOM] = pop_study(STUDY, ALLEEG, ''gui'', ''on'');' e_load_study]; |
|
|
710 |
cb_studydesign = [ nocheck '[STUDYTMP LASTCOM] = pop_studydesign(STUDY, ALLEEG); ALLEEGTMP = ALLEEG;' e_plot_study]; |
|
|
711 |
cb_precomp = [ nocheck '[STUDYTMP ALLEEGTMP LASTCOM] = pop_precomp(STUDY, ALLEEG);' e_plot_study]; |
|
|
712 |
cb_chanplot = [ nocheck '[STUDYTMP LASTCOM] = pop_chanplot(STUDY, ALLEEG); ALLEEGTMP=ALLEEG;' e_plot_study]; |
|
|
713 |
cb_precomp2 = [ nocheck '[STUDYTMP ALLEEGTMP LASTCOM] = pop_precomp(STUDY, ALLEEG, ''components'');' e_plot_study]; |
|
|
714 |
cb_preclust = [ nocheck '[STUDYTMP ALLEEGTMP LASTCOM] = pop_preclust(STUDY, ALLEEG);' e_plot_study]; |
|
|
715 |
cb_clust = [ nocheck '[STUDYTMP ALLEEGTMP LASTCOM] = pop_clust(STUDY, ALLEEG);' e_plot_study]; |
|
|
716 |
cb_clustedit = [ nocheck 'ALLEEGTMP = ALLEEG; [STUDYTMP LASTCOM] = pop_clustedit(STUDY, ALLEEG);' e_plot_study]; |
|
|
717 |
|
|
|
718 |
% |
|
|
719 |
% % add STUDY plugin menus |
|
|
720 |
% if exist('eegplugin_stderpimage') |
|
|
721 |
% structure.uilist = { { } ... |
|
|
722 |
% {'style' 'pushbutton' 'string' 'Plot ERPimage' 'Callback' 'stderpimageplugin_plot(''onecomp'', gcf);' } { } ... |
|
|
723 |
% {'style' 'pushbutton' 'string' 'Plot ERPimage(s)' 'Callback' 'stderpimageplugin_plot(''oneclust'', gcf);' } }; |
|
|
724 |
% structure.geometry = { [1] [1 0.3 1] }; |
|
|
725 |
% arg = vararg2str( { structure } ); |
|
|
726 |
% cb_clustedit = [ nocheck 'ALLEEGTMP = ALLEEG; [STUDYTMP LASTCOM] = pop_clustedit(STUDY, ALLEEG, [], ' arg ');' e_load_study]; |
|
|
727 |
% end; |
|
|
728 |
|
|
|
729 |
% menu definition |
|
|
730 |
% --------------- |
|
|
731 |
% defaults |
|
|
732 |
% -------- |
|
|
733 |
% startup:on |
|
|
734 |
% study:off |
|
|
735 |
% chanloc:off |
|
|
736 |
% epoch:on |
|
|
737 |
% continuous:on |
|
|
738 |
|
|
|
739 |
on = 'study:on'; |
|
|
740 |
onnostudy = ''; |
|
|
741 |
ondata = 'startup:off'; |
|
|
742 |
ondatanoroi = 'startup:off;roi:off'; |
|
|
743 |
onepoch = 'startup:off;continuous:off'; |
|
|
744 |
onepochnoroi = 'startup:off;continuous:off;roi:off'; |
|
|
745 |
ondatastudy = 'startup:off;study:on'; |
|
|
746 |
ondatastudynoroi = 'startup:off;study:on;roi:off'; |
|
|
747 |
onchannel = 'startup:off;chanloc:on'; |
|
|
748 |
onchannelnoroi = 'startup:off;chanloc:on;roi:off'; |
|
|
749 |
onepochchan = 'startup:off;continuous:off;chanloc:on'; |
|
|
750 |
onstudy = 'startup:off;epoch:off;continuous:off;study:on'; |
|
|
751 |
onstudynoroi = 'startup:off;epoch:off;continuous:off;study:on;roi:off'; |
|
|
752 |
|
|
|
753 |
if ~nouiflag |
|
|
754 |
W_MAIN = findobj('tag', 'EEGLAB'); |
|
|
755 |
EEGUSERDAT = get(W_MAIN, 'userdata'); |
|
|
756 |
set(W_MAIN, 'MenuBar', 'none'); |
|
|
757 |
file_m = eegmenu( false, W_MAIN, 'Label', 'File' , 'userdata', on); |
|
|
758 |
import_m = eegmenu( false, file_m, 'Label', 'Import data' , 'userdata', onnostudy); |
|
|
759 |
neuro_m = eegmenu( false, import_m, 'Label', 'Using EEGLAB functions and plugins' , 'tag', 'import data' , 'userdata', onnostudy); |
|
|
760 |
epoch_m = eegmenu( false, file_m, 'Label', 'Import epoch info', 'tag', 'import epoch', 'userdata', onepoch); |
|
|
761 |
event_m = eegmenu( false, file_m, 'Label', 'Import event info', 'tag', 'import event', 'userdata', ondata); |
|
|
762 |
exportm = eegmenu( false, file_m, 'Label', 'Export' , 'tag', 'export' , 'userdata', ondata); |
|
|
763 |
edit_m = eegmenu( false, W_MAIN, 'Label', 'Edit' , 'userdata', ondatastudy); |
|
|
764 |
tools_m = eegmenu( false, W_MAIN, 'Label', 'Tools', 'tag', 'tools' , 'userdata', ondatastudy); |
|
|
765 |
plot_m = eegmenu( false, W_MAIN, 'Label', 'Plot', 'tag', 'plot' , 'userdata', ondata); |
|
|
766 |
loc_m = eegmenu( false, plot_m, 'Label', 'Channel locations' , 'userdata', onchannel); |
|
|
767 |
std_m = eegmenu( false, W_MAIN, 'Label', 'Study', 'tag', 'study' , 'userdata', onstudy); |
|
|
768 |
set_m = eegmenu( false, W_MAIN, 'Label', 'Datasets' , 'userdata', ondatastudy); |
|
|
769 |
help_m = eegmenu( false, W_MAIN, 'Label', 'Help' , 'userdata', on); |
|
|
770 |
|
|
|
771 |
eegmenu( false, neuro_m, 'Label', '(for more use menu File > Manage EEGLAB extensions)', 'userdata', 'enable:off'); |
|
|
772 |
eegmenu( false, neuro_m, 'Label', 'From ASCII/float file or MATLAB array' , 'CallBack', cb_importdata, 'separator', 'on'); |
|
|
773 |
%eegmenu( false, neuro_m, 'Label', 'From Netstation .mff (FILE-IO toolbox)', 'CallBack', cb_fileio2, 'Separator', 'on'); |
|
|
774 |
|
|
|
775 |
% BIOSIG MENUS |
|
|
776 |
% ------------ |
|
|
777 |
eegmenu( false, neuro_m, 'Label', 'From Biosemi BDF file (BIOSIG toolbox)', 'CallBack' , cb_biosig, 'Separator', 'on'); |
|
|
778 |
eegmenu( false, neuro_m, 'Label', 'From EDF/EDF+/GDF files (BIOSIG toolbox)', 'CallBack', cb_biosig); |
|
|
779 |
|
|
|
780 |
eegmenu( false, epoch_m, 'Label', 'From MATLAB array or ASCII file' , 'CallBack', cb_importepoch); |
|
|
781 |
eegmenu( false, event_m, 'Label', 'From MATLAB array or ASCII file' , 'CallBack', cb_importevent); |
|
|
782 |
eegmenu( false, event_m, 'Label', 'From data channel' , 'CallBack', cb_chanevent); |
|
|
783 |
eegmenu( false, event_m, 'Label', 'From Presentation .LOG file' , 'CallBack', cb_importpres); |
|
|
784 |
eegmenu( false, event_m, 'Label', 'From E-Prime ASCII (text) file' , 'CallBack', cb_importevent); |
|
|
785 |
eegmenu( false, event_m, 'Label', 'From ERPLAB text files' , 'CallBack', cb_importerplab); |
|
|
786 |
|
|
|
787 |
eegmenu( false, exportm, 'Label', '(for more use menu File > Manage EEGLAB extensions)', 'userdata', 'enable:off'); |
|
|
788 |
eegmenu( false, exportm, 'Label', 'Data and ICA activity to text file' , 'CallBack', cb_export, 'separator', 'on'); |
|
|
789 |
eegmenu( false, exportm, 'Label', 'Weight matrix to text file' , 'CallBack', cb_expica1); |
|
|
790 |
eegmenu( false, exportm, 'Label', 'Inverse weight matrix to text file' , 'CallBack', cb_expica2); |
|
|
791 |
eegmenu( false, exportm, 'Label', 'Events to text file' , 'CallBack', cb_expevents); |
|
|
792 |
eegmenu( false, exportm, 'Label', 'Data to EDF/BDF/GDF file' , 'CallBack', cb_expdata, 'separator', 'on'); |
|
|
793 |
|
|
|
794 |
eegmenu( false, file_m, 'Label', 'Load existing dataset' , 'userdata', onnostudy, 'CallBack', cb_loadset, 'Separator', 'on'); |
|
|
795 |
eegmenu( false, file_m, 'Label', 'Resave current dataset(s)' , 'userdata', ondatastudy, 'CallBack', cb_saveset); |
|
|
796 |
eegmenu( false, file_m, 'Label', 'Save current dataset as' , 'userdata', ondata, 'CallBack', cb_savesetas); |
|
|
797 |
eegmenu( false, file_m, 'Label', 'Clear dataset(s)' , 'userdata', ondata, 'CallBack', cb_delset); |
|
|
798 |
|
|
|
799 |
std2_m = eegmenu( false, file_m, 'Label', 'Create study' , 'userdata', on , 'Separator', 'on'); |
|
|
800 |
eegmenu( false, std2_m, 'Label', 'Using all loaded datasets' , 'userdata', ondata , 'Callback', cb_study1); |
|
|
801 |
eegmenu( false, std2_m, 'Label', 'Browse for datasets' , 'userdata', on , 'Callback', cb_study2); |
|
|
802 |
eegmenu( false, std2_m, 'Label', 'Simple ERP STUDY' , 'userdata', on , 'Callback', cb_studyerp); |
|
|
803 |
|
|
|
804 |
eegmenu( false, file_m, 'Label', 'Load existing study' , 'userdata', on , 'CallBack', cb_loadstudy,'Separator', 'on' ); |
|
|
805 |
eegmenu( false, file_m, 'Label', 'Save current study' , 'userdata', onstudy, 'CallBack', cb_savestudy1); |
|
|
806 |
eegmenu( false, file_m, 'Label', 'Save current study as' , 'userdata', onstudy, 'CallBack', cb_savestudy2); |
|
|
807 |
eegmenu( false, file_m, 'Label', 'Clear study / Clear all' , 'userdata', ondatastudy, 'CallBack', cb_clearstudy); |
|
|
808 |
eegmenu( false, file_m, 'Label', 'Preferences' , 'userdata', on , 'CallBack', cb_editoptions, 'Separator', 'on'); |
|
|
809 |
|
|
|
810 |
hist_m = eegmenu( false, file_m, 'Label', 'History scripts' , 'userdata', on , 'Separator', 'on'); |
|
|
811 |
eegmenu( false, hist_m, 'Label', 'Save dataset history script' , 'userdata', ondata , 'CallBack', cb_saveh1); |
|
|
812 |
eegmenu( false, hist_m, 'Label', 'Save session history script' , 'userdata', ondatastudy, 'CallBack', cb_saveh2); |
|
|
813 |
eegmenu( false, hist_m, 'Label', 'Run script' , 'userdata', on , 'CallBack', cb_runsc); |
|
|
814 |
if isdeployed |
|
|
815 |
eegmenu( false, hist_m, 'Label', 'Test compiled version' , 'userdata', on , 'CallBack', @test_compiled_version); |
|
|
816 |
end |
|
|
817 |
|
|
|
818 |
if ~isdeployed |
|
|
819 |
eegmenu( false, file_m, 'Label', 'Manage EEGLAB extensions' , 'userdata', on, 'CallBack', cb_plugin); |
|
|
820 |
end |
|
|
821 |
eegmenu( false, file_m, 'Label', 'Quit' , 'userdata', on , 'CallBack', cb_quit, 'Separator', 'on'); |
|
|
822 |
|
|
|
823 |
eegmenu( false, edit_m, 'Label', 'Dataset info' , 'userdata', ondata, 'CallBack', cb_editset); |
|
|
824 |
eegmenu( versL, edit_m, 'Label', 'Event fields' , 'userdata', ondata, 'CallBack', cb_editeventf); |
|
|
825 |
eegmenu( false, edit_m, 'Label', 'Event values' , 'userdata', ondata, 'CallBack', cb_editeventv); |
|
|
826 |
eegmenu( versL, edit_m, 'Label', 'Adjust event latencies' , 'userdata', ondata, 'CallBack', cb_adjustevents); |
|
|
827 |
eegmenu( false, edit_m, 'Label', 'About this dataset' , 'userdata', ondata, 'CallBack', cb_comments); |
|
|
828 |
eegmenu( false, edit_m, 'Label', 'Channel locations' , 'userdata', ondatastudy, 'CallBack', cb_chanedit); |
|
|
829 |
eegmenu( false, edit_m, 'Label', 'Select data' , 'userdata', ondatastudy, 'CallBack', cb_select, 'Separator', 'on'); |
|
|
830 |
eegmenu( false, edit_m, 'Label', 'Select data using events' , 'userdata', ondatastudy, 'CallBack', cb_rmdat); |
|
|
831 |
eegmenu( false, edit_m, 'Label', 'Select epochs or events' , 'userdata', ondatastudy, 'CallBack', cb_selectevent); |
|
|
832 |
eegmenu( false, edit_m, 'Label', 'Copy current dataset' , 'userdata', ondata, 'CallBack', cb_copyset, 'Separator', 'on'); |
|
|
833 |
eegmenu( false, edit_m, 'Label', 'Append datasets' , 'userdata', ondata, 'CallBack', cb_mergeset); |
|
|
834 |
eegmenu( false, edit_m, 'Label', 'Delete dataset(s) from memory' , 'userdata', ondata, 'CallBack', cb_delset); |
|
|
835 |
|
|
|
836 |
eegmenu(~versL, tools_m, 'Label', '(Expand tool choices via "File > Preferences")' , 'userdata', 'enable:off'); |
|
|
837 |
eegmenu( false, tools_m, 'Label', 'Change sampling rate' , 'userdata', ondatastudy, 'CallBack', cb_resample, 'Separator', 'on'); |
|
|
838 |
|
|
|
839 |
filter_m = eegmenu( false, tools_m, 'Label', 'Filter the data' , 'userdata', ondatastudy, 'tag', 'filter'); |
|
|
840 |
eegmenu( false, filter_m, 'Label', 'Basic FIR filter (legacy)' , 'userdata', ondatastudy, 'CallBack', cb_eegfilt); |
|
|
841 |
|
|
|
842 |
eegmenu( false, tools_m, 'Label', 'Re-reference the data' , 'userdata', ondatastudy, 'CallBack', cb_reref); |
|
|
843 |
eegmenu( false, tools_m, 'Label', 'Interpolate electrodes' , 'userdata', ondata, 'CallBack', cb_interp); |
|
|
844 |
eegmenu( false, tools_m, 'Label', 'Inspect/reject data by eye' , 'userdata', ondata, 'CallBack', cb_eegplot, 'Separator', 'on'); |
|
|
845 |
eegmenu( versL, tools_m, 'Label', 'Automatic channel rejection' , 'userdata', ondata, 'CallBack', cb_chanrej); |
|
|
846 |
eegmenu( versL, tools_m, 'Label', 'Automatic continuous rejection' , 'userdata', ondata, 'CallBack', cb_rejcont); |
|
|
847 |
eegmenu( versL, tools_m, 'Label', 'Automatic epoch rejection' , 'userdata', onepoch, 'CallBack', cb_autorej); |
|
|
848 |
eegmenu( false, tools_m, 'Label', 'Decompose data by ICA' , 'userdata', ondatastudynoroi, 'CallBack', cb_runica, 'Separator', 'on'); |
|
|
849 |
rej_m1 = eegmenu( versL, tools_m, 'Label', 'Reject data epochs' , 'userdata', onepoch); |
|
|
850 |
rej_m2 = eegmenu( versL, tools_m, 'Label', 'Reject data using ICA' , 'userdata', ondata ); |
|
|
851 |
|
|
|
852 |
eegmenu( versL, rej_m1, 'Label', 'Reject data (all methods)' , 'userdata', onepoch, 'CallBack', cb_rejmenu1); |
|
|
853 |
eegmenu( versL, rej_m1, 'Label', 'Reject by inspection' , 'userdata', onepoch, 'CallBack', cb_eegplotrej1); |
|
|
854 |
eegmenu( versL, rej_m1, 'Label', 'Reject extreme values' , 'userdata', onepoch, 'CallBack', cb_eegthresh1); |
|
|
855 |
eegmenu( versL, rej_m1, 'Label', 'Reject by linear trend/variance' , 'userdata', onepoch, 'CallBack', cb_rejtrend1); |
|
|
856 |
eegmenu( versL, rej_m1, 'Label', 'Reject by probability' , 'userdata', onepoch, 'CallBack', cb_jointprob1); |
|
|
857 |
eegmenu( versL, rej_m1, 'Label', 'Reject by kurtosis' , 'userdata', onepoch, 'CallBack', cb_rejkurt1); |
|
|
858 |
eegmenu( versL, rej_m1, 'Label', 'Reject by spectra' , 'userdata', onepoch, 'CallBack', cb_rejspec1); |
|
|
859 |
eegmenu( versL, rej_m1, 'Label', 'Export marks to ICA reject' , 'userdata', onepoch, 'CallBack', cb_rejsup1, 'separator', 'on'); |
|
|
860 |
eegmenu( versL, rej_m1, 'Label', 'Reject marked epochs' , 'userdata', onepoch, 'CallBack', cb_rejsup2, 'separator', 'on', 'foregroundcolor', 'b'); |
|
|
861 |
eegmenu(~versL, tools_m,'Label', 'Inspect/label components by map' , 'userdata', ondata , 'CallBack', cb_selectcomps); |
|
|
862 |
eegmenu( versL, rej_m2, 'Label', 'Reject components by map' , 'userdata', ondata , 'CallBack', cb_selectcomps); |
|
|
863 |
eegmenu( versL, rej_m2, 'Label', 'Reject data (all methods)' , 'userdata', onepoch, 'CallBack', cb_rejmenu2, 'Separator', 'on'); |
|
|
864 |
eegmenu( versL, rej_m2, 'Label', 'Reject by inspection' , 'userdata', onepoch, 'CallBack', cb_eegplotrej2); |
|
|
865 |
eegmenu( versL, rej_m2, 'Label', 'Reject extreme values' , 'userdata', onepoch, 'CallBack', cb_eegthresh2); |
|
|
866 |
eegmenu( versL, rej_m2, 'Label', 'Reject by linear trend/variance' , 'userdata', onepoch, 'CallBack', cb_rejtrend2); |
|
|
867 |
eegmenu( versL, rej_m2, 'Label', 'Reject by probability' , 'userdata', onepoch, 'CallBack', cb_jointprob2); |
|
|
868 |
eegmenu( versL, rej_m2, 'Label', 'Reject by kurtosis' , 'userdata', onepoch, 'CallBack', cb_rejkurt2); |
|
|
869 |
eegmenu( versL, rej_m2, 'Label', 'Reject by spectra' , 'userdata', onepoch, 'CallBack', cb_rejspec2); |
|
|
870 |
eegmenu( versL, rej_m2, 'Label', 'Export marks to data reject' , 'userdata', onepoch, 'CallBack', cb_rejsup3, 'separator', 'on'); |
|
|
871 |
eegmenu( versL, rej_m2, 'Label', 'Reject marked epochs' , 'userdata', onepoch, 'CallBack', cb_rejsup4, 'separator', 'on', 'foregroundcolor', 'b'); |
|
|
872 |
|
|
|
873 |
eegmenu( false, tools_m, 'Label', 'Remove components from data' , 'userdata', ondatastudy, 'CallBack', cb_subcomp ); |
|
|
874 |
eegmenu( false, tools_m, 'Label', 'Extract epochs' , 'userdata', ondatastudy , 'CallBack', cb_epoch, 'Separator', 'on'); |
|
|
875 |
eegmenu( false, tools_m, 'Label', 'Remove epoch baseline' , 'userdata', ondatastudy , 'CallBack', cb_rmbase); |
|
|
876 |
|
|
|
877 |
eegmenu( false, loc_m, 'Label', 'By name' , 'userdata', onchannel, 'CallBack', cb_topoblank1); |
|
|
878 |
eegmenu( false, loc_m, 'Label', 'By number' , 'userdata', onchannel, 'CallBack', cb_topoblank2); |
|
|
879 |
eegmenu( false, plot_m, 'Label', 'Channel data (scroll)' , 'userdata', ondata , 'CallBack', cb_eegplot1, 'Separator', 'on'); |
|
|
880 |
eegmenu( false, plot_m, 'Label', 'Channel spectra and maps' , 'userdata', ondata , 'CallBack', cb_spectopo1); |
|
|
881 |
eegmenu( false, plot_m, 'Label', 'Channel properties' , 'userdata', ondata , 'CallBack', cb_prop1); |
|
|
882 |
eegmenu( false, plot_m, 'Label', 'Channel ERP image' , 'userdata', onepoch, 'CallBack', cb_erpimage1); |
|
|
883 |
|
|
|
884 |
ERP_m = eegmenu( false, plot_m, 'Label', 'Channel ERPs' , 'userdata', onepoch); |
|
|
885 |
eegmenu( false, ERP_m, 'Label', 'With scalp maps' , 'CallBack', cb_timtopo); |
|
|
886 |
eegmenu( false, ERP_m, 'Label', 'In scalp/rect. array' , 'CallBack', cb_plottopo); |
|
|
887 |
|
|
|
888 |
topo_m = eegmenu( false, plot_m, 'Label', 'ERP map series' , 'userdata', onepochchan); |
|
|
889 |
eegmenu( false, topo_m, 'Label', 'In 2-D' , 'CallBack', cb_topoplot1); |
|
|
890 |
eegmenu( false, topo_m, 'Label', 'In 3-D' , 'CallBack', cb_headplot1); |
|
|
891 |
eegmenu( versL, plot_m, 'Label', 'Sum/Compare ERPs' , 'userdata', onepoch, 'CallBack', cb_comperp1); |
|
|
892 |
eegmenu(~versL, plot_m, 'Label', 'Channel time-frequency' , 'CallBack', cb_timef1); |
|
|
893 |
|
|
|
894 |
eegmenu( false, plot_m, 'Label', 'Component activations (scroll)' , 'userdata', ondata , 'CallBack', cb_eegplot2,'Separator', 'on'); |
|
|
895 |
eegmenu( false, plot_m, 'Label', 'Component spectra and maps' , 'userdata', ondatanoroi, 'CallBack', cb_spectopo2); |
|
|
896 |
|
|
|
897 |
tica_m = eegmenu( false, plot_m, 'Label', 'Component maps' , 'userdata', onchannelnoroi); |
|
|
898 |
eegmenu( false, tica_m, 'Label', 'In 2-D' , 'CallBack', cb_topoplot2); |
|
|
899 |
eegmenu( false, tica_m, 'Label', 'In 3-D' , 'CallBack', cb_headplot2); |
|
|
900 |
eegmenu( false, plot_m, 'Label', 'Component properties' , 'userdata', ondata , 'CallBack', cb_prop2); |
|
|
901 |
eegmenu( false, plot_m, 'Label', 'Component ERP image' , 'userdata', onepoch, 'CallBack', cb_erpimage2); |
|
|
902 |
|
|
|
903 |
ERPC_m = eegmenu( false, plot_m, 'Label', 'Component ERPs' , 'userdata', onepoch); |
|
|
904 |
eegmenu( false, ERPC_m, 'Label', 'With component maps' , 'userdata', onepochnoroi, 'CallBack', cb_envtopo1); |
|
|
905 |
eegmenu( false, ERPC_m, 'Label', 'With comp. maps (compare)' , 'userdata', onepochnoroi, 'CallBack', cb_envtopo2); |
|
|
906 |
eegmenu( false, ERPC_m, 'Label', 'In rectangular array' , 'userdata', onepoch , 'CallBack', cb_plotdata2); |
|
|
907 |
eegmenu( versL, plot_m, 'Label', 'Sum/Compare comp. ERPs' , 'userdata', onepochnoroi, 'userdata', onepoch, 'CallBack', cb_comperp2); |
|
|
908 |
|
|
|
909 |
stat_m = eegmenu( versL, plot_m, 'Label', 'Data statistics', 'Separator', 'on', 'userdata', ondata ); |
|
|
910 |
eegmenu( versL, stat_m, 'Label', 'Channel statistics' , 'CallBack', cb_signalstat1); |
|
|
911 |
eegmenu( versL, stat_m, 'Label', 'Component statistics' , 'CallBack', cb_signalstat2); |
|
|
912 |
eegmenu( versL, stat_m, 'Label', 'Event statistics' , 'CallBack', cb_eventstat); |
|
|
913 |
|
|
|
914 |
spec_m = eegmenu( versL, plot_m, 'Label', 'Time-frequency transforms', 'Separator', 'on', 'userdata', ondata); |
|
|
915 |
eegmenu( versL, spec_m, 'Label', 'Channel time-frequency' , 'CallBack', cb_timef1); |
|
|
916 |
eegmenu( versL, spec_m, 'Label', 'Channel cross-coherence' , 'CallBack', cb_crossf1); |
|
|
917 |
eegmenu( versL, spec_m, 'Label', 'Component time-frequency' , 'CallBack', cb_timef2,'Separator', 'on'); |
|
|
918 |
eegmenu( versL, spec_m, 'Label', 'Component cross-coherence' , 'CallBack', cb_crossf2); |
|
|
919 |
eegmenu(~versL, plot_m, 'Label', 'Component time-frequency' , 'CallBack', cb_timef2); |
|
|
920 |
|
|
|
921 |
eegmenu( false, std_m, 'Label', 'Edit study info' , 'userdata', onstudy, 'CallBack', cb_study3); |
|
|
922 |
eegmenu( false, std_m, 'Label', 'Select/Edit study design(s)' , 'userdata', onstudy, 'CallBack', cb_studydesign); |
|
|
923 |
eegmenu( false, std_m, 'Label', 'Precompute channel measures' , 'userdata', onstudy, 'CallBack', cb_precomp, 'separator', 'on'); |
|
|
924 |
eegmenu( false, std_m, 'Label', 'Plot channel measures' , 'userdata', onstudy, 'CallBack', cb_chanplot); |
|
|
925 |
eegmenu( false, std_m, 'Label', 'Precompute component measures' , 'userdata', onstudy, 'CallBack', cb_precomp2, 'separator', 'on'); |
|
|
926 |
clust_m = eegmenu( false, std_m, 'Label', 'PCA clustering (original)' , 'userdata', onstudynoroi); |
|
|
927 |
eegmenu( false, clust_m, 'Label', 'Build preclustering array' , 'userdata', onstudynoroi, 'CallBack', cb_preclust); |
|
|
928 |
eegmenu( false, clust_m, 'Label', 'Cluster components' , 'userdata', onstudynoroi, 'CallBack', cb_clust); |
|
|
929 |
eegmenu( false, std_m, 'Label', 'Edit/plot component clusters' , 'userdata', onstudy, 'CallBack', cb_clustedit); |
|
|
930 |
|
|
|
931 |
if ~isdeployed && ismatlab |
|
|
932 |
%newerVersionMenu = eegmenu( false, help_m, 'Label', 'Upgrade to the Latest Version' , 'userdata', on, 'ForegroundColor', [0.6 0 0]); |
|
|
933 |
eegmenu( false, help_m, 'Label', 'About EEGLAB' , 'userdata', on, 'CallBack', 'pophelp(''eeglab'');'); |
|
|
934 |
eegmenu( false, help_m, 'Label', 'Check for EEGLAB update' , 'userdata', on, 'CallBack', 'eeglab_update;'); |
|
|
935 |
eegmenu( false, help_m, 'Label', 'About EEGLAB help' , 'userdata', on, 'CallBack', 'pophelp(''eeg_helphelp'');'); |
|
|
936 |
eegmenu( false, help_m, 'Label', 'EEGLAB menus' , 'userdata', on, 'CallBack', 'pophelp(''eeg_helpmenu'');','separator','on'); |
|
|
937 |
|
|
|
938 |
help_1 = eegmenu( false, help_m, 'Label', 'EEGLAB functions', 'userdata', on); |
|
|
939 |
eegmenu( false, help_1, 'Label', 'Admin. functions' , 'userdata', on, 'Callback', 'pophelp(''eeg_helpadmin'');'); |
|
|
940 |
eegmenu( false, help_1, 'Label', 'Interactive pop_ functions' , 'userdata', on, 'Callback', 'pophelp(''eeg_helppop'');'); |
|
|
941 |
eegmenu( false, help_1, 'Label', 'Signal processing functions' , 'userdata', on, 'Callback', 'pophelp(''eeg_helpsigproc'');'); |
|
|
942 |
eegmenu( false, help_1, 'Label', 'Group data (STUDY) functions' , 'userdata', on, 'Callback', 'pophelp(''eeg_helpstudy'');'); |
|
|
943 |
eegmenu( false, help_1, 'Label', 'Time-frequency functions' , 'userdata', on, 'Callback', 'pophelp(''eeg_helptimefreq'');'); |
|
|
944 |
eegmenu( false, help_1, 'Label', 'Statistical functions' , 'userdata', on, 'Callback', 'pophelp(''eeg_helpstatistics'');'); |
|
|
945 |
eegmenu( false, help_1, 'Label', 'Graphic interface builder functions' , 'userdata', on, 'Callback', 'pophelp(''eeg_helpgui'');'); |
|
|
946 |
eegmenu( false, help_1, 'Label', 'Misc. command line functions' , 'userdata', on, 'Callback', 'pophelp(''eeg_helpmisc'');'); |
|
|
947 |
|
|
|
948 |
eegmenu( false, help_m, 'Label', 'EEGLAB license' , 'userdata', on, 'CallBack', 'pophelp(''eeglablicense.txt'', 1);'); |
|
|
949 |
eegmenu( false, help_m, 'Label', 'EEGLAB tutorial' , 'userdata', on, 'CallBack', 'tutorial;', 'Separator', 'on'); |
|
|
950 |
eegmenu( false, help_m, 'Label', 'Email the EEGLAB team' , 'userdata', on, 'CallBack', 'web(''mailto:eeglab@sccn.ucsd.edu'');'); |
|
|
951 |
else |
|
|
952 |
eegmenu( false, help_m, 'Label', 'About EEGLAB' , 'userdata', on, 'CallBack', 'abouteeglab;'); |
|
|
953 |
eegmenu( false, help_m, 'Label', 'EEGLAB license' , 'userdata', on, 'CallBack', 'pophelp(''eeglablicense.txt'', 1);'); |
|
|
954 |
eegmenu( false, help_m, 'Label', 'EEGLAB tutorial' , 'userdata', on, 'CallBack', 'tutorial;', 'Separator', 'on'); |
|
|
955 |
end |
|
|
956 |
|
|
|
957 |
end |
|
|
958 |
|
|
|
959 |
statusconnection = 1; |
|
|
960 |
eeglabVersionStatus = []; |
|
|
961 |
if isdeployed || (exist('ismcc') && ismcc) |
|
|
962 |
if ~nouiflag |
|
|
963 |
disp('Loading plugins'); |
|
|
964 |
funcname = { ... |
|
|
965 |
@eegplugin_eepimport, ... |
|
|
966 |
@eegplugin_iclabel, ... |
|
|
967 |
@eegplugin_VisEd, ... |
|
|
968 |
@eegplugin_eegbids, ... |
|
|
969 |
@eegplugin_bva_io, ... |
|
|
970 |
@eegplugin_clean_rawdata, ... |
|
|
971 |
@eegplugin_dipfit, ... |
|
|
972 |
@eegplugin_egilegacy, ... |
|
|
973 |
@eegplugin_firfilt, ... |
|
|
974 |
@eegplugin_iirfilt, ... |
|
|
975 |
@eegplugin_musedirect, ... |
|
|
976 |
@eegplugin_musemonitor, ... |
|
|
977 |
@eegplugin_neuroscanio, ... |
|
|
978 |
@eegplugin_scd, ... |
|
|
979 |
@eegplugin_snapmaster, ... |
|
|
980 |
@eegplugin_xdfimport, ... |
|
|
981 |
@eegplugin_mffmatlabio, ... |
|
|
982 |
}; |
|
|
983 |
for indf = 1:length(funcname) |
|
|
984 |
pluginfun = funcname{indf}; |
|
|
985 |
pluginname = func2str(pluginfun); |
|
|
986 |
try |
|
|
987 |
outargs = nargout(pluginfun); |
|
|
988 |
if outargs == 1 |
|
|
989 |
vers = feval(pluginfun, gcf, trystrs, catchstrs); |
|
|
990 |
disp(['EEGLAB: adding "' vers '" plugin' ]); |
|
|
991 |
else |
|
|
992 |
feval(funcname{indf}, gcf, trystrs, catchstrs); |
|
|
993 |
disp(['EEGLAB: adding plugin function "' pluginname '"' ]); |
|
|
994 |
end |
|
|
995 |
catch e |
|
|
996 |
disp(['EEGLAB: Could not load "' pluginname '": ' e.message]); |
|
|
997 |
end |
|
|
998 |
end |
|
|
999 |
end |
|
|
1000 |
else |
|
|
1001 |
pluginlist = []; |
|
|
1002 |
plugincount = 1; |
|
|
1003 |
|
|
|
1004 |
eeglabp = fileparts(mywhich('eeglab.m')); |
|
|
1005 |
|
|
|
1006 |
% scan plugin folder |
|
|
1007 |
% ------------------ |
|
|
1008 |
dircontent = dir(fullfile(eeglabp, 'plugins')); |
|
|
1009 |
if ~isfield(dircontent, 'folder') |
|
|
1010 |
[dircontent(:).folder] = deal(fullfile(eeglabp, 'plugins')); |
|
|
1011 |
end |
|
|
1012 |
|
|
|
1013 |
% scan local plugin folder |
|
|
1014 |
% ------------------------ |
|
|
1015 |
if ~isequal(pwd, eeglabp) |
|
|
1016 |
dircontent2 = dir(fullfile(pwd, 'plugins')); |
|
|
1017 |
if ~isempty(dircontent2) |
|
|
1018 |
fprintf(2, 'WARNING: plugins in current folders may shadow plugins installed in EEGLAB plugins folder\n'); |
|
|
1019 |
if ~isfield(dircontent2, 'folder') |
|
|
1020 |
[dircontent2(:).folder] = deal(fullfile(pwd, 'plugins')); |
|
|
1021 |
end |
|
|
1022 |
dircontent = [dircontent;dircontent2]; |
|
|
1023 |
end |
|
|
1024 |
end |
|
|
1025 |
|
|
|
1026 |
pluginstats = []; |
|
|
1027 |
if option_checkversion && ismatlab |
|
|
1028 |
disp('Retrieving plugin versions from server...'); |
|
|
1029 |
try |
|
|
1030 |
[pluginstats, eeglabVersionStatus] = plugin_getweb('startup', pluginlist); |
|
|
1031 |
catch |
|
|
1032 |
disp('Issue with retrieving statistics for extensions'); |
|
|
1033 |
end |
|
|
1034 |
if ~isfield(pluginstats, 'name') || ~isfield(pluginstats, 'version') |
|
|
1035 |
pluginstats = []; |
|
|
1036 |
end |
|
|
1037 |
end |
|
|
1038 |
|
|
|
1039 |
for index = 1:length(dircontent) |
|
|
1040 |
|
|
|
1041 |
% find function |
|
|
1042 |
% ------------- |
|
|
1043 |
funcname = ''; |
|
|
1044 |
pluginVersion = []; |
|
|
1045 |
if exist(fullfile(dircontent(index).folder, dircontent(index).name), 'dir') |
|
|
1046 |
if ~strcmpi(dircontent(index).name, '.') && ~strcmpi(dircontent(index).name, '..') |
|
|
1047 |
tmpdir = dir(fullfile(dircontent(index).folder, dircontent(index).name, 'eegplugin*.m')); |
|
|
1048 |
|
|
|
1049 |
if ~isempty(tmpdir) |
|
|
1050 |
%myaddpath(eeglabpath, tmpdir(1).name, newpath); |
|
|
1051 |
funcname = tmpdir(1).name(1:end-2); |
|
|
1052 |
end |
|
|
1053 |
addpathifnotinlist(fullfile(dircontent(index).folder, dircontent(index).name)); |
|
|
1054 |
[ pluginName, pluginVersion ] = parsepluginname(dircontent(index).name, funcname(11:end)); |
|
|
1055 |
|
|
|
1056 |
% special case of subfolder for Fieldtrip |
|
|
1057 |
% --------------------------------------- |
|
|
1058 |
if ~isempty(findstr(lower(dircontent(index).name), 'bids-matlab-tools')) |
|
|
1059 |
fprintf(2, 'Warning: The bids-matlab-tools plugin is obsolete, uninstall and install EEG-BIDS instead\n'); |
|
|
1060 |
elseif ~isempty(findstr(lower(dircontent(index).name), 'fieldtrip')) && isempty(findstr(lower(dircontent(index).name), 'rest')) |
|
|
1061 |
addpathifnotexist( fullfile(dircontent(index).folder, dircontent(index).name, 'compat') , 'electrodenormalize' ); |
|
|
1062 |
addpathifnotexist( fullfile(dircontent(index).folder, dircontent(index).name, 'forward'), 'ft_sourcedepth.m'); |
|
|
1063 |
addpathifnotexist( fullfile(dircontent(index).folder, dircontent(index).name, 'utilities'), 'ft_datatype.m'); |
|
|
1064 |
addpathifnotexist( fullfile(dircontent(index).folder, dircontent(index).name, 'plotting'), 'ft_plot_mesh.m'); |
|
|
1065 |
ptopoplot = fileparts(mywhich('cbar')); |
|
|
1066 |
ptopoplot2 = fileparts(mywhich('topoplot')); |
|
|
1067 |
if ~isequal(ptopoplot, ptopoplot2) |
|
|
1068 |
addpath(ptopoplot); |
|
|
1069 |
end |
|
|
1070 |
% remove folders which should not have been added |
|
|
1071 |
if ismatlab |
|
|
1072 |
tmppath = fullfile(dircontent(index).folder, dircontent(index).name, 'external'); |
|
|
1073 |
if ~isempty(findstr(path, tmppath)) |
|
|
1074 |
allpaths = path; |
|
|
1075 |
indperiod = [0 find(allpaths == ':') length(allpaths)+1 ]; |
|
|
1076 |
for iPath = 1:length(indperiod)-1 |
|
|
1077 |
curpath = allpaths(indperiod(iPath)+1:indperiod(iPath+1)-1); |
|
|
1078 |
if contains(curpath, tmppath) |
|
|
1079 |
fprintf('Removing path %s\n', curpath); |
|
|
1080 |
rmpath(curpath); |
|
|
1081 |
end |
|
|
1082 |
end |
|
|
1083 |
end |
|
|
1084 |
end |
|
|
1085 |
end |
|
|
1086 |
|
|
|
1087 |
|
|
|
1088 |
% special case of subfolder for BIOSIG |
|
|
1089 |
% ------------------------------------ |
|
|
1090 |
if ~isempty(findstr(lower(dircontent(index).name), 'biosig')) && isempty(strfind(lower(dircontent(index).name), 'biosigplot')) |
|
|
1091 |
addpathifnotexist( fullfile(dircontent(index).folder, dircontent(index).name, 'biosig', 't200_FileAccess'), 'sopen.m'); |
|
|
1092 |
addpathifnotexist( fullfile(dircontent(index).folder, dircontent(index).name, 'biosig', 't250_ArtifactPreProcessingQualityControl'), 'regress_eog.m' ); |
|
|
1093 |
addpathifnotexist( fullfile(dircontent(index).folder, dircontent(index).name, 'biosig', 'doc'), 'DecimalFactors.txt'); |
|
|
1094 |
end |
|
|
1095 |
|
|
|
1096 |
end |
|
|
1097 |
else |
|
|
1098 |
if ~isempty(findstr(dircontent(index).name, 'eegplugin')) && dircontent(index).name(end) == 'm' |
|
|
1099 |
funcname = dircontent(index).name(1:end-2); % remove .m |
|
|
1100 |
[ pluginName, pluginVersion ] = parsepluginname(dircontent(index).name(10:end-2)); |
|
|
1101 |
end |
|
|
1102 |
end |
|
|
1103 |
|
|
|
1104 |
% execute function |
|
|
1105 |
% ---------------- |
|
|
1106 |
if ~isempty(pluginVersion) || ~isempty(funcname) |
|
|
1107 |
if isempty(funcname) |
|
|
1108 |
fprintf([ 'EEGLAB: adding "' pluginName '" v' pluginVersion ' to the path' ]); |
|
|
1109 |
pluginlist(plugincount).plugin = pluginName; |
|
|
1110 |
pluginlist(plugincount).version = pluginVersion; |
|
|
1111 |
pluginlist(plugincount).foldername = dircontent(index).name; |
|
|
1112 |
pluginlist(plugincount).status = 'ok'; |
|
|
1113 |
if ~isempty(pluginstats) |
|
|
1114 |
indPlugin = strmatch(lower(pluginlist(plugincount).plugin), lower({ pluginstats.name }), 'exact'); |
|
|
1115 |
else |
|
|
1116 |
indPlugin = []; |
|
|
1117 |
end |
|
|
1118 |
if ~isempty(indPlugin) |
|
|
1119 |
if ~strcmpi(pluginVersion, pluginstats(indPlugin).version) |
|
|
1120 |
fprintf(2, ' - new version %s available\n', pluginstats(indPlugin).version); |
|
|
1121 |
else |
|
|
1122 |
fprintf('\n'); |
|
|
1123 |
end |
|
|
1124 |
else |
|
|
1125 |
fprintf('\n'); |
|
|
1126 |
end |
|
|
1127 |
plugincount = plugincount+1; |
|
|
1128 |
else |
|
|
1129 |
pluginlist(plugincount).plugin = pluginName; |
|
|
1130 |
pluginlist(plugincount).version = pluginVersion; |
|
|
1131 |
vers2 = ''; |
|
|
1132 |
status = 'ok'; |
|
|
1133 |
if ~nouiflag |
|
|
1134 |
try |
|
|
1135 |
%eval( [ 'vers2 =' funcname '(gcf, trystrs, catchstrs);' ]); |
|
|
1136 |
vers2 = feval(funcname, gcf, trystrs, catchstrs); |
|
|
1137 |
[~, vers2] = parsepluginname(vers2); |
|
|
1138 |
catch |
|
|
1139 |
try |
|
|
1140 |
eval( [ funcname '(gcf, trystrs, catchstrs)' ]); |
|
|
1141 |
catch |
|
|
1142 |
disp([ 'EEGLAB: error while adding plugin "' funcname '"' ] ); |
|
|
1143 |
disp([ ' ' lasterr] ); |
|
|
1144 |
status = 'error'; |
|
|
1145 |
end |
|
|
1146 |
end |
|
|
1147 |
end |
|
|
1148 |
if isempty(pluginlist(plugincount).version) |
|
|
1149 |
pluginlist(plugincount).version = vers2; |
|
|
1150 |
elseif ~isempty(vers2) |
|
|
1151 |
if ~isequal(pluginlist(plugincount).version, vers2) |
|
|
1152 |
fprintf('WARNING: for plugin "%s" version in the folder name "%s" and in the eegplugin_ file "%s" differ\n', pluginlist(plugincount).plugin, pluginlist(plugincount).version,vers2); |
|
|
1153 |
end |
|
|
1154 |
end |
|
|
1155 |
pluginlist(plugincount).funcname = funcname(10:end); |
|
|
1156 |
pluginlist(plugincount).foldername = dircontent(index).name; |
|
|
1157 |
if length(pluginlist(plugincount).funcname) > 1 && pluginlist(plugincount).funcname(1) == '_' |
|
|
1158 |
pluginlist(plugincount).funcname(1) = []; |
|
|
1159 |
end |
|
|
1160 |
if strcmpi(status, 'ok') |
|
|
1161 |
vers = pluginlist(plugincount).version; % version |
|
|
1162 |
if isempty(vers), vers = '?'; end |
|
|
1163 |
fprintf('EEGLAB: adding "%s" v%s (see >> help %s)', ... |
|
|
1164 |
pluginlist(plugincount).plugin, vers, funcname); |
|
|
1165 |
if ~isempty(pluginstats) |
|
|
1166 |
indPlugin = strmatch(lower(pluginlist(plugincount).plugin), lower({ pluginstats.name }), 'exact'); |
|
|
1167 |
if length(indPlugin) == 1 |
|
|
1168 |
if ~isempty(pluginstats(indPlugin).custommsg) |
|
|
1169 |
if length(pluginstats(indPlugin).custommsg) > 50 |
|
|
1170 |
fprintf(2, ' - %s...\n', pluginstats(indPlugin).custommsg(1:50)); |
|
|
1171 |
else |
|
|
1172 |
fprintf(2, ' - %s\n', pluginstats(indPlugin).custommsg); |
|
|
1173 |
end |
|
|
1174 |
elseif ~strcmpi(vers, pluginstats(indPlugin).version) |
|
|
1175 |
if isequal(pluginstats(indPlugin).critical, 1) |
|
|
1176 |
fprintf(2, ' - new version %s available (critical bug fix)\n', pluginstats(indPlugin).version); |
|
|
1177 |
else |
|
|
1178 |
fprintf(2, ' - new version %s available\n', pluginstats(indPlugin).version); |
|
|
1179 |
end |
|
|
1180 |
else |
|
|
1181 |
fprintf('\n'); |
|
|
1182 |
end |
|
|
1183 |
else |
|
|
1184 |
fprintf('\n'); |
|
|
1185 |
end |
|
|
1186 |
else |
|
|
1187 |
fprintf('\n'); |
|
|
1188 |
end |
|
|
1189 |
end |
|
|
1190 |
pluginlist(plugincount).status = status; |
|
|
1191 |
plugincount = plugincount+1; |
|
|
1192 |
end |
|
|
1193 |
end |
|
|
1194 |
end |
|
|
1195 |
global PLUGINLIST; |
|
|
1196 |
PLUGINLIST = pluginlist; |
|
|
1197 |
|
|
|
1198 |
% add menus for plugins to install |
|
|
1199 |
% -------------------------------- |
|
|
1200 |
if ismatlab && ~nouiflag |
|
|
1201 |
if ~exist('mff_import', 'file') |
|
|
1202 |
neuro_m = findobj(W_MAIN, 'tag', 'import data'); |
|
|
1203 |
cb_mff = [ 'if ~plugin_askinstall(''mffmatlabio'', ''mff_import''), return; end;' ... |
|
|
1204 |
'eval(char(get(findobj(''label'', ''Import Magstim/EGI .mff file''), ''callback'')));' ]; |
|
|
1205 |
eegmenu( false, neuro_m, 'Label', 'Import Magstim/EGI .mff file', 'CallBack', cb_mff, 'separator', 'on'); |
|
|
1206 |
end |
|
|
1207 |
if ~exist('eegplugin_neuroscanio', 'file') |
|
|
1208 |
neuro_m = findobj(W_MAIN, 'tag', 'import data'); |
|
|
1209 |
neuroscan_check = 'if ~plugin_askinstall(''neuroscanio'', ''eegplugin_neuroscanio''), return; end;'; |
|
|
1210 |
cb_neuroscan1 = [ neuroscan_check 'eval(char(get(findobj(''label'', ''From Neuroscan .CNT file''), ''callback'')));' ]; |
|
|
1211 |
cb_neuroscan2 = [ neuroscan_check 'eval(char(get(findobj(''label'', ''From Neuroscan .EEG file''), ''callback'')));' ]; |
|
|
1212 |
eegmenu( false, neuro_m, 'Label', 'From Neuroscan .CNT file', 'CallBack', cb_neuroscan1, 'Separator', 'on'); |
|
|
1213 |
eegmenu( false, neuro_m, 'Label', 'From Neuroscan .EEG file', 'CallBack', cb_neuroscan2); |
|
|
1214 |
end |
|
|
1215 |
if ~exist('eegplugin_firfilt', 'file') |
|
|
1216 |
neuro_m = findobj(W_MAIN, 'tag', 'filter'); |
|
|
1217 |
cb_filter = [ 'if ~plugin_askinstall(''firfilt'', ''eegplugin_firfilt''), return; end;' ... |
|
|
1218 |
'eval(char(get(findobj(''label'', ''Basic FIR filter (new, default)''), ''callback'')));' ]; |
|
|
1219 |
eegmenu( false, neuro_m, 'Label', 'Basic FIR filter (new, default)', 'CallBack', cb_filter, 'separator', 'on'); |
|
|
1220 |
end |
|
|
1221 |
if ~exist('eegplugin_iclabel', 'file') |
|
|
1222 |
fprintf(2, 'Warning: ICLabel default plugin missing (probably due to downloading zip file from Github). Install manually.\n'); |
|
|
1223 |
end |
|
|
1224 |
if ~exist('eegplugin_clean_rawdata', 'file') |
|
|
1225 |
fprintf(2, 'Warning: Clean Rawdata plugin missing (probably due to downloading zip file from Github). Install manually.\n'); |
|
|
1226 |
end |
|
|
1227 |
if ~exist('pop_dipfit_settings', 'file') |
|
|
1228 |
neuro_m = findobj(W_MAIN, 'tag', 'tools'); |
|
|
1229 |
cb_dipfit = 'if ~plugin_askinstall(''dipfit'', ''pop_dipfit_settings''), return; end;' ; |
|
|
1230 |
eegmenu( false, neuro_m, 'Label', 'Locate dipoles using DIPFIT 2.x', 'CallBack', cb_dipfit, 'separator', 'on'); |
|
|
1231 |
end |
|
|
1232 |
if ~exist('pop_loadbva', 'file') |
|
|
1233 |
neuro_m = findobj(W_MAIN, 'tag', 'import data'); |
|
|
1234 |
cb_bva1 = [ 'if ~plugin_askinstall(''bva-io'', ''pop_loadbva''), return; end;' ... |
|
|
1235 |
'eval(char(get(findobj(''label'', ''From Brain Vis. Rec. .vhdr file''), ''callback'')));' ]; |
|
|
1236 |
cb_bva2 = [ 'if ~plugin_askinstall(''bva-io'', ''pop_loadbva''), return; end;' ... |
|
|
1237 |
'eval(char(get(findobj(''label'', ''From Brain Vis. Anal. Matlab file''), ''callback'')));' ]; |
|
|
1238 |
eegmenu( false, neuro_m, 'Label', 'From Brain Vis. Rec. .vhdr file', 'CallBack', cb_bva1, 'separator', 'on'); |
|
|
1239 |
eegmenu( false, neuro_m, 'Label', 'From Brain Vis. Anal. Matlab file', 'CallBack', cb_bva2); |
|
|
1240 |
end |
|
|
1241 |
end |
|
|
1242 |
end |
|
|
1243 |
|
|
|
1244 |
% Path exception for BIOSIG (sending BIOSIG down into the path) |
|
|
1245 |
biosigpathlast; % fix str2double issue |
|
|
1246 |
|
|
|
1247 |
% push SIFT path last for dipplot |
|
|
1248 |
dipplotpath = fileparts( which('dipplot') ); |
|
|
1249 |
dipfitpath = fileparts( which('dipfit_1_to_2') ); |
|
|
1250 |
if ~strcmp(dipplotpath,dipfitpath) |
|
|
1251 |
addpath(dipfitpath,'-begin'); |
|
|
1252 |
end |
|
|
1253 |
|
|
|
1254 |
if exist(onearg, 'file') % execute script |
|
|
1255 |
pop_runscript(onearg); |
|
|
1256 |
elseif any(onearg == ';') % execute code if there is a semicolumn in the argument |
|
|
1257 |
evalin('base', onearg); |
|
|
1258 |
end |
|
|
1259 |
|
|
|
1260 |
if nouiflag |
|
|
1261 |
return; |
|
|
1262 |
end |
|
|
1263 |
|
|
|
1264 |
% add other import ... |
|
|
1265 |
% -------------------- |
|
|
1266 |
cb_others = [ 'pophelp(''troubleshooting_data_formats'');' ]; |
|
|
1267 |
eegmenu( false, import_m, 'Label', 'Using the FILE-IO interface', 'CallBack', cb_fileio, 'separator', 'on'); |
|
|
1268 |
eegmenu( false, import_m, 'Label', 'Using the BIOSIG interface' , 'CallBack', cb_biosig); |
|
|
1269 |
eegmenu( false, import_m, 'Label', 'Troubleshooting data formats...', 'CallBack', cb_others); |
|
|
1270 |
|
|
|
1271 |
% changing plugin menu color |
|
|
1272 |
% -------------------------- |
|
|
1273 |
fourthsub_m = findobj('parent', tools_m); |
|
|
1274 |
plotsub_m = findobj('parent', plot_m); |
|
|
1275 |
importsub_m = findobj('parent', neuro_m); |
|
|
1276 |
epochsub_m = findobj('parent', epoch_m); |
|
|
1277 |
eventsub_m = findobj('parent', event_m); |
|
|
1278 |
editsub_m = findobj('parent', edit_m); |
|
|
1279 |
exportsub_m = findobj('parent', exportm); |
|
|
1280 |
filter_m = findobj('parent', filter_m); |
|
|
1281 |
|
|
|
1282 |
% check if ERPLAB overloads icadefs |
|
|
1283 |
% -------------------------- |
|
|
1284 |
icadefsPath = fileparts(which('icadefs')); |
|
|
1285 |
if ~isempty(findstr('erplab', lower(icadefsPath))) |
|
|
1286 |
rmpath(icadefsPath); |
|
|
1287 |
if isempty(which('icadefs')) |
|
|
1288 |
addpath(icadefsPath); |
|
|
1289 |
end |
|
|
1290 |
end |
|
|
1291 |
|
|
|
1292 |
icadefs; % containing PLUGINMENUCOLOR |
|
|
1293 |
if versL, tm = 14; else tm = 16; end |
|
|
1294 |
if length(fourthsub_m) > tm, set(fourthsub_m(1:end-tm), 'foregroundcolor', PLUGINMENUCOLOR); end |
|
|
1295 |
if length(plotsub_m) > 17, set(plotsub_m (1:end-17), 'foregroundcolor', PLUGINMENUCOLOR); end |
|
|
1296 |
if length(importsub_m) > 4, set(importsub_m(1:end-4) , 'foregroundcolor', PLUGINMENUCOLOR); end |
|
|
1297 |
if length(epochsub_m ) > 3 , set(epochsub_m (1:end-3 ), 'foregroundcolor', PLUGINMENUCOLOR); end |
|
|
1298 |
if length(eventsub_m ) > 4 , set(eventsub_m (1:end-4 ), 'foregroundcolor', PLUGINMENUCOLOR); end |
|
|
1299 |
if length(exportsub_m) > 4 , set(exportsub_m(1:end-4 ), 'foregroundcolor', PLUGINMENUCOLOR); end |
|
|
1300 |
if length(editsub_m) > 10, set(editsub_m( 1:end-10), 'foregroundcolor', PLUGINMENUCOLOR); end |
|
|
1301 |
if length(filter_m) > 3 , set(filter_m (1:end-1 ), 'foregroundcolor', PLUGINMENUCOLOR); end |
|
|
1302 |
|
|
|
1303 |
EEGMENU = eegmenu( false, set_m, 'Label', '------', 'Enable', 'off'); |
|
|
1304 |
eval('set(W_MAIN, ''userdat'', { EEGUSERDAT{1} EEGMENU });'); |
|
|
1305 |
eeglab('redraw'); |
|
|
1306 |
if nargout < 1 |
|
|
1307 |
clear ALLEEG; |
|
|
1308 |
end |
|
|
1309 |
|
|
|
1310 |
% check if update is available |
|
|
1311 |
if ismatlab |
|
|
1312 |
eeglab_update(eeglabVersionStatus); |
|
|
1313 |
end |
|
|
1314 |
|
|
|
1315 |
% REMOVED MENUS |
|
|
1316 |
%eegmenu( false, tools_m, 'Label', 'Automatic comp. reject', 'enable', 'off', 'CallBack', '[EEG LASTCOM] = pop_rejcomp(EEG); eegh(LASTCOM); if ~isempty(LASTCOM), eeg_store(CURRENTSET); end;'); |
|
|
1317 |
%eegmenu( false, tools_m, 'Label', 'Reject (synthesis)' , 'Separator', 'on', 'CallBack', '[EEG LASTCOM] = pop_rejall(EEG); eegh(LASTCOM); if ~isempty(LASTCOM), eeg_store; end; eeglab(''redraw'');'); |
|
|
1318 |
|
|
|
1319 |
% |
|
|
1320 |
% -------------------- |
|
|
1321 |
% draw the main figure |
|
|
1322 |
% -------------------- |
|
|
1323 |
|
|
|
1324 |
function eeg_mainfig(onearg) |
|
|
1325 |
|
|
|
1326 |
icadefs; |
|
|
1327 |
COLOR = BACKEEGLABCOLOR; |
|
|
1328 |
WINMINX = 17; |
|
|
1329 |
WINMAXX = 260; |
|
|
1330 |
WINYDEC = 13; |
|
|
1331 |
NBLINES = 16; |
|
|
1332 |
WINY = WINYDEC*NBLINES; |
|
|
1333 |
|
|
|
1334 |
BORDERINT = 4; |
|
|
1335 |
BORDEREXT = 10; |
|
|
1336 |
comp = computer; |
|
|
1337 |
if strcmpi(comp(1:3), 'GLN') || strcmpi(comp(1:3), 'MAC') || strcmpi(comp(1:3), 'PCW') |
|
|
1338 |
FONTNAME = 'courier'; |
|
|
1339 |
FONTSIZE = 8; |
|
|
1340 |
% Magnify figure under MATLAB 2012a |
|
|
1341 |
vers = version; |
|
|
1342 |
dotPos = find(vers == '.'); |
|
|
1343 |
vernum = str2num(vers(1:dotPos(1)-1)); |
|
|
1344 |
subvernum = str2num(vers(dotPos(1)+1:dotPos(2)-1)); |
|
|
1345 |
if vernum > 7 || (vernum >= 7 && subvernum >= 14) |
|
|
1346 |
FONTSIZE = FONTSIZE+2; |
|
|
1347 |
WINMAXX = WINMAXX*1.3; |
|
|
1348 |
WINY = WINY*1.3; |
|
|
1349 |
end |
|
|
1350 |
else |
|
|
1351 |
FONTNAME = ''; |
|
|
1352 |
FONTSIZE = 11; |
|
|
1353 |
end |
|
|
1354 |
if ~ismatlab |
|
|
1355 |
WINMAXX = WINMAXX*1.35; |
|
|
1356 |
WINY = WINY*1.4; |
|
|
1357 |
end |
|
|
1358 |
|
|
|
1359 |
hh = findobj('tag', 'EEGLAB'); |
|
|
1360 |
if ~isempty(hh) |
|
|
1361 |
disp('EEGLAB warning: there can be only one EEGLAB window, closing old one'); |
|
|
1362 |
close(hh); |
|
|
1363 |
end |
|
|
1364 |
|
|
|
1365 |
% determine the text for the revision |
|
|
1366 |
[txtVersion, numVersion ] = eeg_getversion; |
|
|
1367 |
if ~isempty(numVersion) |
|
|
1368 |
txtVersion = [ 'EEGLAB v' txtVersion ]; |
|
|
1369 |
else |
|
|
1370 |
txtVersion = [ 'EEGLAB ' txtVersion ]; |
|
|
1371 |
end |
|
|
1372 |
if ~ismatlab && ismac |
|
|
1373 |
txtVersion = [ txtVersion ' - menu is on the top bar' ]; |
|
|
1374 |
end |
|
|
1375 |
|
|
|
1376 |
% create figures |
|
|
1377 |
if strcmpi(onearg, 'remote') |
|
|
1378 |
figure( 'name', txtVersion, ... |
|
|
1379 |
'numbertitle', 'off', ... |
|
|
1380 |
'Position',[200 100 (WINMINX+WINMAXX+2*BORDERINT+2*BORDEREXT) 30 ], ... |
|
|
1381 |
'color', COLOR, ... |
|
|
1382 |
'Tag','EEGLAB', ... |
|
|
1383 |
'Userdata', {[] []}); |
|
|
1384 |
%'resize', 'off', ... |
|
|
1385 |
return; |
|
|
1386 |
end |
|
|
1387 |
|
|
|
1388 |
W_MAIN = figure('Units','points', ... |
|
|
1389 |
... % 'Colormap','gray', ... |
|
|
1390 |
'PaperPosition',[18 180 576 432], ... |
|
|
1391 |
'PaperUnits','points', ... |
|
|
1392 |
'name', txtVersion, ... |
|
|
1393 |
'numbertitle', 'off', ... |
|
|
1394 |
'Position',[200 100 (WINMINX+WINMAXX+2*BORDERINT+2*BORDEREXT) (WINY+2*BORDERINT+2*BORDEREXT) ], ... |
|
|
1395 |
'color', COLOR, ... |
|
|
1396 |
'Tag','EEGLAB', ... |
|
|
1397 |
'visible', 'off', ... |
|
|
1398 |
'Userdata', {[] []}); |
|
|
1399 |
% 'resize', 'off', ... |
|
|
1400 |
|
|
|
1401 |
% java chat |
|
|
1402 |
eeglab_options; |
|
|
1403 |
|
|
|
1404 |
try |
|
|
1405 |
set(W_MAIN, 'NextPlot','new'); |
|
|
1406 |
catch, end |
|
|
1407 |
|
|
|
1408 |
BackgroundColor = get(gcf, 'color'); %[0.701960784313725 0.701960784313725 0.701960784313725]; |
|
|
1409 |
H_MAIN(1) = uicontrol('Parent',W_MAIN, ... |
|
|
1410 |
'Units','points', ... |
|
|
1411 |
'BackgroundColor',COLOR, ... |
|
|
1412 |
'ListboxTop',0, ... |
|
|
1413 |
'HorizontalAlignment', 'left',... |
|
|
1414 |
'Position',[BORDEREXT BORDEREXT (WINMINX+WINMAXX+2*BORDERINT) (WINY)], ... |
|
|
1415 |
'Style','frame', ... |
|
|
1416 |
'Tag','Frame1'); |
|
|
1417 |
set(H_MAIN(1), 'unit', 'normalized'); |
|
|
1418 |
geometry = { [1] [1] [1] [1 1] [1 1] [1 1] [1 1] [1 1] [1 1] [1 1] [1 1] [1 1] [1 1] [1 1] [1] }; |
|
|
1419 |
listui = { { 'style', 'text', 'string', 'Parameters of the current set', 'tag', 'win0' } { } ... |
|
|
1420 |
{ 'style', 'text', 'tag', 'win1', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1421 |
{ 'style', 'text', 'tag', 'win2', 'string', 'Channels per frame', 'userdata', 'datinfo'} ... |
|
|
1422 |
{ 'style', 'text', 'tag', 'val2', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1423 |
{ 'style', 'text', 'tag', 'win3', 'string', 'Frames per epoch', 'userdata', 'datinfo'} ... |
|
|
1424 |
{ 'style', 'text', 'tag', 'val3', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1425 |
{ 'style', 'text', 'tag', 'win4', 'string', 'Epochs', 'userdata', 'datinfo'} ... |
|
|
1426 |
{ 'style', 'text', 'tag', 'val4', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1427 |
{ 'style', 'text', 'tag', 'win5', 'string', 'Events', 'userdata', 'datinfo'} ... |
|
|
1428 |
{ 'style', 'text', 'tag', 'val5', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1429 |
{ 'style', 'text', 'tag', 'win6', 'string', 'Sampling rate (Hz)', 'userdata', 'datinfo' } ... |
|
|
1430 |
{ 'style', 'text', 'tag', 'val6', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1431 |
{ 'style', 'text', 'tag', 'win7', 'string', 'Epoch start (sec)', 'userdata', 'datinfo' } ... |
|
|
1432 |
{ 'style', 'text', 'tag', 'val7', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1433 |
{ 'style', 'text', 'tag', 'win8', 'string', 'Epoch end (sec)', 'userdata', 'datinfo' } ... |
|
|
1434 |
{ 'style', 'text', 'tag', 'val8', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1435 |
{ 'style', 'text', 'tag', 'win9', 'string', 'Average reference', 'userdata', 'datinfo' } ... |
|
|
1436 |
{ 'style', 'text', 'tag', 'val9', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1437 |
{ 'style', 'text', 'tag', 'win10', 'string', 'Channel locations', 'userdata', 'datinfo'} ... |
|
|
1438 |
{ 'style', 'text', 'tag', 'val10', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1439 |
{ 'style', 'text', 'tag', 'win11', 'string', 'ICA weights', 'userdata', 'datinfo' } ... |
|
|
1440 |
{ 'style', 'text', 'tag', 'val11', 'string', ' ', 'userdata', 'datinfo' } ... |
|
|
1441 |
{ 'style', 'text', 'tag', 'win12', 'string', 'Dataset size (Mb)', 'userdata', 'datinfo' } ... |
|
|
1442 |
{ 'style', 'text', 'tag', 'val12', 'string', ' ', 'userdata', 'datinfo' } {} }; |
|
|
1443 |
supergui(gcf, geometry, [], listui{:}); |
|
|
1444 |
geometry = { [1] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1 0.01] [1] }; |
|
|
1445 |
listui = { { } ... |
|
|
1446 |
{ 'style', 'text', 'tag', 'mainwin0', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1447 |
{ 'style', 'text', 'tag', 'mainwin1', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1448 |
{ 'style', 'text', 'tag', 'mainwin2', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1449 |
{ 'style', 'text', 'tag', 'mainwin3', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1450 |
{ 'style', 'text', 'tag', 'mainwin4', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1451 |
{ 'style', 'text', 'tag', 'mainwin5', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1452 |
{ 'style', 'text', 'tag', 'mainwin6', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1453 |
{ 'style', 'text', 'tag', 'mainwin7', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1454 |
{ 'style', 'text', 'tag', 'mainwin8', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1455 |
{ 'style', 'text', 'tag', 'mainwin9', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1456 |
{ 'style', 'text', 'tag', 'mainwin10', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1457 |
{ 'style', 'text', 'tag', 'mainwin11', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1458 |
{ 'style', 'text', 'tag', 'mainwin12', 'string', ' ', 'userdata', 'fullline' } { } ... |
|
|
1459 |
{ 'style', 'text', 'tag', 'mainwin13', 'string', ' ', 'userdata', 'fullline' } { } {} }; |
|
|
1460 |
firstElemHeight = 1; |
|
|
1461 |
if ispc, firstElemHeight = 1.7; end |
|
|
1462 |
supergui(gcf, geometry, [firstElemHeight 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1], listui{:}); |
|
|
1463 |
|
|
|
1464 |
titleh = findobj('parent', gcf, 'tag', 'win0'); |
|
|
1465 |
alltexth = findobj('parent', gcf, 'style', 'text'); |
|
|
1466 |
alltexth = setdiff_bc(alltexth, titleh); |
|
|
1467 |
|
|
|
1468 |
set(gcf, 'Position',[200 100 (WINMINX+WINMAXX+2*BORDERINT+2*BORDEREXT) (WINY+2*BORDERINT+2*BORDEREXT) ]); |
|
|
1469 |
set(titleh, 'fontsize', TEXT_FONTSIZE_L, 'fontweight', 'bold'); |
|
|
1470 |
set(alltexth, 'fontname', FONTNAME, 'fontsize', FONTSIZE); |
|
|
1471 |
|
|
|
1472 |
set(W_MAIN, 'visible', 'on'); |
|
|
1473 |
|
|
|
1474 |
return; |
|
|
1475 |
|
|
|
1476 |
% Update EEGLAB GUI (list of datasets) |
|
|
1477 |
% ----------------- |
|
|
1478 |
function updatemenu() |
|
|
1479 |
eeg_global; |
|
|
1480 |
|
|
|
1481 |
W_MAIN = findobj('tag', 'EEGLAB'); |
|
|
1482 |
EEGUSERDAT = get(W_MAIN, 'userdata'); |
|
|
1483 |
H_MAIN = EEGUSERDAT{1}; |
|
|
1484 |
EEGMENU = EEGUSERDAT{2}; |
|
|
1485 |
if exist('CURRENTSET') ~= 1, CURRENTSET = 0; end |
|
|
1486 |
if isempty(ALLEEG), ALLEEG = []; end |
|
|
1487 |
if isempty(EEG), EEG = []; end |
|
|
1488 |
|
|
|
1489 |
% test if the menu is present |
|
|
1490 |
try |
|
|
1491 |
figure(W_MAIN); |
|
|
1492 |
set_m = findobj( 'parent', W_MAIN, 'Label', 'Datasets'); |
|
|
1493 |
catch, return; end |
|
|
1494 |
index = 1; |
|
|
1495 |
indexmenu = 1; |
|
|
1496 |
|
|
|
1497 |
% check if EEG has changed |
|
|
1498 |
% ------------------------ |
|
|
1499 |
tmp = warning; |
|
|
1500 |
warning off; |
|
|
1501 |
clear functions; |
|
|
1502 |
warning(tmp); |
|
|
1503 |
eeglab_options; |
|
|
1504 |
if isempty(ALLEEG) && ~isempty(EEG) && all(arrayfun(@(eeg) ~isempty(eeg.data), EEG)) |
|
|
1505 |
ALLEEG = EEG; |
|
|
1506 |
else |
|
|
1507 |
% check dataset |
|
|
1508 |
if ~isempty(EEG) && ~isempty(ALLEEG) && CURRENTSET(1) > 0 && ~isequaln(EEG, ALLEEG(CURRENTSET)) |
|
|
1509 |
if length(EEG) > 1 |
|
|
1510 |
options = { 'EEG overwrites ALLEEG', 'ALLEEG overwrites EEG', 'Do nothing' }; |
|
|
1511 |
res = questdlg2('In a STUDY, ALLEEG and EEG should be equal and they are not. How do you want EEGLAB to resolve this?', 'ALLEEG and EEG structure do not match', options{:}, options{1}); |
|
|
1512 |
if isequal(res, options{1}) |
|
|
1513 |
disp('Overwriting ALLEEG with EEG') |
|
|
1514 |
ALLEEG = EEG; |
|
|
1515 |
elseif isequal(res, options{2}) |
|
|
1516 |
disp('Overwriting EEG with ALLEEG') |
|
|
1517 |
EEG = ALLEEG; |
|
|
1518 |
end |
|
|
1519 |
else |
|
|
1520 |
EEG.saved = 'no'; |
|
|
1521 |
[ALLEEG, EEG, CURRENTSET] = pop_newset(ALLEEG, EEG, CURRENTSET, 'study', ~isempty(STUDY)+0, 'guistring', 'The EEG structure has changed, what do you want to do?'); |
|
|
1522 |
end |
|
|
1523 |
end |
|
|
1524 |
end |
|
|
1525 |
|
|
|
1526 |
% Maximum number of set |
|
|
1527 |
% --------------------- |
|
|
1528 |
MAX_SET = max(length( ALLEEG ), length(EEGMENU)-1); |
|
|
1529 |
if MAX_SET > 200 |
|
|
1530 |
disp('Updating menu, restricting menu selection to the first 200 datasets to speed up display...') |
|
|
1531 |
MAX_SET = 200; |
|
|
1532 |
end |
|
|
1533 |
|
|
|
1534 |
% setting the dataset menu |
|
|
1535 |
% ------------------------ |
|
|
1536 |
while( index <= MAX_SET) |
|
|
1537 |
try |
|
|
1538 |
set( EEGMENU(index), 'Label', '------', 'checked', 'off'); |
|
|
1539 |
catch |
|
|
1540 |
if mod(index, 30) == 0 |
|
|
1541 |
tag = [ 'More (' int2str(index/30) ') ->' ]; |
|
|
1542 |
tmp_m = findobj('label', tag); |
|
|
1543 |
if isempty(tmp_m) |
|
|
1544 |
set_m = eegmenu( false, set_m, 'Label', tag, 'userdata', 'study:on'); |
|
|
1545 |
else set_m = tmp_m; |
|
|
1546 |
end |
|
|
1547 |
end |
|
|
1548 |
try |
|
|
1549 |
set( EEGMENU(index), 'Label', '------', 'checked', 'off'); |
|
|
1550 |
catch, EEGMENU(index) = eegmenu( false, set_m, 'Label', '------', 'Enable', 'on'); end |
|
|
1551 |
end |
|
|
1552 |
set( EEGMENU(index), 'Enable', 'on', 'separator', 'off' ); |
|
|
1553 |
try, ALLEEG(index).data; |
|
|
1554 |
if ~isempty( ALLEEG(index).data) |
|
|
1555 |
|
|
|
1556 |
cb_retrieve = [ '[ALLEEG EEG CURRENTSET LASTCOM] = pop_newset(ALLEEG, EEG, CURRENTSET, ''retrieve'', ' int2str(index) ', ''study'', ~isempty(STUDY)+0);' ... |
|
|
1557 |
'if CURRENTSTUDY && ~isempty(LASTCOM), CURRENTSTUDY = 0; LASTCOM = [ ''CURRENTSTUDY = 0;'' LASTCOM ]; end; eegh(LASTCOM);' ... |
|
|
1558 |
'eeglab(''redraw'');' ]; |
|
|
1559 |
|
|
|
1560 |
menutitle = sprintf('Dataset %d:%s', index, ALLEEG(index).setname); |
|
|
1561 |
set( EEGMENU(index), 'Label', menutitle, 'userdata', 'study:on'); |
|
|
1562 |
set( EEGMENU(index), 'CallBack', cb_retrieve ); |
|
|
1563 |
set( EEGMENU(index), 'Enable', 'on' ); |
|
|
1564 |
if any(index == CURRENTSET), set( EEGMENU(index), 'checked', 'on' ); end |
|
|
1565 |
end |
|
|
1566 |
catch, end |
|
|
1567 |
index = index+1; |
|
|
1568 |
end |
|
|
1569 |
hh = findobj( 'parent', set_m, 'Label', '------'); |
|
|
1570 |
set(hh, 'Enable', 'off'); |
|
|
1571 |
|
|
|
1572 |
% menu for selecting several datasets |
|
|
1573 |
% ----------------------------------- |
|
|
1574 |
if index ~= 0 |
|
|
1575 |
cb_select = [ 'nonempty = find(~cellfun(''isempty'', { ALLEEG.data } ));' ... |
|
|
1576 |
'tmpind = pop_chansel({ ALLEEG(nonempty).setname }, ''withindex'', nonempty);' ... |
|
|
1577 |
'if ~isempty(tmpind),' ... |
|
|
1578 |
' [ALLEEG EEG CURRENTSET LASTCOM] = pop_newset(ALLEEG, EEG, CURRENTSET, ''retrieve'', nonempty(tmpind), ''study'', ~isempty(STUDY)+0);' ... |
|
|
1579 |
' eegh(LASTCOM);' ... |
|
|
1580 |
' eeglab(''redraw'');' ... |
|
|
1581 |
'end;' ... |
|
|
1582 |
'clear tmpind nonempty;' ]; |
|
|
1583 |
if MAX_SET == length(EEGMENU), EEGMENU(end+1) = eegmenu( false, set_m, 'Label', '------', 'Enable', 'on'); end |
|
|
1584 |
|
|
|
1585 |
set(EEGMENU(end), 'enable', 'on', 'Label', 'Select multiple datasets', ... |
|
|
1586 |
'callback', cb_select, 'separator', 'on', 'userdata', 'study:on'); |
|
|
1587 |
end |
|
|
1588 |
|
|
|
1589 |
% STUDY consistency |
|
|
1590 |
% ----------------- |
|
|
1591 |
exist_study = 0; |
|
|
1592 |
if exist('STUDY') && exist('CURRENTSTUDY') |
|
|
1593 |
|
|
|
1594 |
% if study present, check study consistency with loaded datasets |
|
|
1595 |
% -------------------------------------------------------------- |
|
|
1596 |
if ~isempty(STUDY) |
|
|
1597 |
if length(ALLEEG) > length(STUDY.datasetinfo) || ~isfield(ALLEEG, 'data') || any(cellfun('isempty', {ALLEEG.data})) |
|
|
1598 |
if strcmpi(STUDY.saved, 'no') |
|
|
1599 |
res = questdlg2( strvcat('The study is not compatible with the datasets present in memory', ... |
|
|
1600 |
'It is self consistent but EEGLAB is not be able to process it.', ... |
|
|
1601 |
'Do you wish to save the study as it is (EEGLAB will prompt you to', ... |
|
|
1602 |
'enter a file name) or do you wish to remove it'), 'Study inconsistency', 'Save and remove', 'Remove', 'Remove' ); |
|
|
1603 |
if strcmpi(res, 'Remove') |
|
|
1604 |
STUDY = []; |
|
|
1605 |
CURRENTSTUDY = 0; |
|
|
1606 |
else |
|
|
1607 |
pop_savestudy(STUDY, ALLEEG); |
|
|
1608 |
STUDY = []; |
|
|
1609 |
CURRENTSTUDY = 0; |
|
|
1610 |
end |
|
|
1611 |
else |
|
|
1612 |
warndlg2( strvcat('The study was not compatible any more with the datasets present in memory.', ... |
|
|
1613 |
'Since it had not changed since last saved, it was simply removed from', ... |
|
|
1614 |
'memory.') ); |
|
|
1615 |
STUDY = []; |
|
|
1616 |
CURRENTSTUDY = 0; |
|
|
1617 |
end |
|
|
1618 |
end |
|
|
1619 |
end |
|
|
1620 |
|
|
|
1621 |
if ~isempty(STUDY) |
|
|
1622 |
exist_study = 1; |
|
|
1623 |
end |
|
|
1624 |
end |
|
|
1625 |
|
|
|
1626 |
% menu for selecting STUDY set |
|
|
1627 |
% ---------------------------- |
|
|
1628 |
if exist_study |
|
|
1629 |
cb_select = [ '[ALLEEG EEG CURRENTSET LASTCOM] = pop_newset(ALLEEG, EEG, CURRENTSET, ''retrieve'', [STUDY.datasetinfo.index], ''study'', 1);' ... |
|
|
1630 |
'if ~isempty(LASTCOM), CURRENTSTUDY = 1; LASTCOM = [ LASTCOM ''CURRENTSTUDY = 1;'' ]; end;' ... |
|
|
1631 |
'eegh(LASTCOM);' ... |
|
|
1632 |
'eeglab(''redraw'');' ]; |
|
|
1633 |
if length(EEGMENU) > 1 |
|
|
1634 |
if isnumeric(EEGMENU) |
|
|
1635 |
if isequal( get(EEGMENU(end), 'text'), 'Select the study set') |
|
|
1636 |
delete(EEGMENU(end)); % in case it is not at the end |
|
|
1637 |
EEGMENU(end) = []; |
|
|
1638 |
end |
|
|
1639 |
elseif isequal( EEGMENU(end).Text, 'Select the study set') |
|
|
1640 |
delete(EEGMENU(end)); % in case it is not at the end |
|
|
1641 |
EEGMENU(end) = []; |
|
|
1642 |
end |
|
|
1643 |
end |
|
|
1644 |
EEGMENU(end+1) = eegmenu( false, set_m, 'Label', 'Select the study set', 'Enable', 'on', 'userdata', 'study:on'); |
|
|
1645 |
set(EEGMENU(end), 'enable', 'on', 'callback', cb_select, 'separator', 'on'); |
|
|
1646 |
else |
|
|
1647 |
if length(EEGMENU) > 1 |
|
|
1648 |
if isnumeric(EEGMENU) |
|
|
1649 |
if isequal( get(EEGMENU(end), 'text'), 'Select the study set') |
|
|
1650 |
delete(EEGMENU(end)); % in case it is not at the end |
|
|
1651 |
EEGMENU(end) = []; |
|
|
1652 |
end |
|
|
1653 |
elseif isequal( EEGMENU(end).Text, 'Select the study set') |
|
|
1654 |
delete(EEGMENU(end)); % in case it is not at the end |
|
|
1655 |
EEGMENU(end) = []; |
|
|
1656 |
end |
|
|
1657 |
end |
|
|
1658 |
end |
|
|
1659 |
|
|
|
1660 |
EEGUSERDAT{2} = EEGMENU; |
|
|
1661 |
set(W_MAIN, 'userdata', EEGUSERDAT); |
|
|
1662 |
|
|
|
1663 |
if (isempty(CURRENTSET) || length(ALLEEG) < CURRENTSET(1) || CURRENTSET(1) == 0 || isempty(ALLEEG(CURRENTSET(1)).data)) |
|
|
1664 |
CURRENTSET = 0; |
|
|
1665 |
for index = 1:length(ALLEEG) |
|
|
1666 |
if ~isempty(ALLEEG(index).data) |
|
|
1667 |
CURRENTSET = index; |
|
|
1668 |
break; |
|
|
1669 |
end |
|
|
1670 |
end |
|
|
1671 |
if CURRENTSET ~= 0 |
|
|
1672 |
eegh([ '[EEG ALLEEG CURRENTSET] = eeg_retrieve(ALLEEG,' int2str(CURRENTSET) ');' ]) |
|
|
1673 |
[EEG, ALLEEG] = eeg_retrieve(ALLEEG, CURRENTSET); |
|
|
1674 |
else |
|
|
1675 |
EEG = eeg_emptyset; |
|
|
1676 |
end |
|
|
1677 |
end |
|
|
1678 |
|
|
|
1679 |
if (isempty(EEG) || isempty(EEG(1).data)) && CURRENTSET(1) ~= 0 |
|
|
1680 |
eegh([ '[EEG ALLEEG CURRENTSET] = eeg_retrieve(ALLEEG,' int2str(CURRENTSET) ');' ]) |
|
|
1681 |
[EEG, ALLEEG] = eeg_retrieve(ALLEEG, CURRENTSET); |
|
|
1682 |
end |
|
|
1683 |
|
|
|
1684 |
% test if dataset has changed |
|
|
1685 |
% --------------------------- |
|
|
1686 |
if length(EEG) == 1 && length(CURRENTSET) == 1 |
|
|
1687 |
if ~isempty(ALLEEG) && CURRENTSET~= 0 && ~isequal(EEG.data, ALLEEG(CURRENTSET).data) |
|
|
1688 |
if exist('isequaln','builtin') ~= 5, isequalfunc = @isequal; else isequalfunc = @isequaln; end |
|
|
1689 |
if isequalfunc(EEG.data, ALLEEG(CURRENTSET).data) |
|
|
1690 |
disp('Warning: Your data contains NaNs.'); |
|
|
1691 |
else |
|
|
1692 |
disp('Warning: The backup dataset in EEGLAB memory does not match the current dataset.'); |
|
|
1693 |
disp(' The dataset in memory has been overwritten'); |
|
|
1694 |
[ALLEEG, EEG, CURRENTSET] = eeg_store(ALLEEG, EEG, CURRENTSET); |
|
|
1695 |
eegh('[ALLEEG EEG CURRENTSET] = eeg_store(ALLEEG, EEG, CURRENTSET);'); |
|
|
1696 |
end |
|
|
1697 |
end |
|
|
1698 |
else |
|
|
1699 |
EEG = ALLEEG(CURRENTSET); |
|
|
1700 |
end |
|
|
1701 |
|
|
|
1702 |
% print some information on the main figure |
|
|
1703 |
% ------------------------------------------ |
|
|
1704 |
g = myguihandles(gcf); |
|
|
1705 |
if ~isfield(g, 'win0') % no display |
|
|
1706 |
return; |
|
|
1707 |
end |
|
|
1708 |
|
|
|
1709 |
study_selected = 0; |
|
|
1710 |
if exist('STUDY') && exist('CURRENTSTUDY') |
|
|
1711 |
if CURRENTSTUDY == 1, study_selected = 1; end |
|
|
1712 |
end |
|
|
1713 |
|
|
|
1714 |
menustatus = {}; |
|
|
1715 |
try |
|
|
1716 |
curroiFlag = unique(cellfun(@(x)getfield(x, 'eeglab_using_roi'), { EEG(:).roi })); |
|
|
1717 |
if length(curroiFlag) == 1 && curroiFlag |
|
|
1718 |
menustatus = { menustatus{:} 'roi_connect' }; |
|
|
1719 |
else |
|
|
1720 |
disp('Warning: different settings for using ROIs detected in different datasets'); |
|
|
1721 |
end |
|
|
1722 |
catch |
|
|
1723 |
end |
|
|
1724 |
if study_selected |
|
|
1725 |
menustatus = { menustatus{:} 'study' }; |
|
|
1726 |
|
|
|
1727 |
hh = findobj('parent', gcf, 'userdata', 'fullline'); set(hh, 'visible', 'off'); |
|
|
1728 |
hh = findobj('parent', gcf, 'userdata', 'datinfo'); set(hh, 'visible', 'on'); |
|
|
1729 |
|
|
|
1730 |
% head string |
|
|
1731 |
% ----------- |
|
|
1732 |
set( g.win0, 'String', sprintf('STUDY set: %s', STUDY.name) ); |
|
|
1733 |
|
|
|
1734 |
% dataset type |
|
|
1735 |
% ------------ |
|
|
1736 |
datasettype = unique_bc( [ EEG.trials ] ); |
|
|
1737 |
if datasettype(1) == 1 && length(datasettype) == 1, datasettype = 'continuous'; |
|
|
1738 |
elseif datasettype(1) == 1, datasettype = 'epoched and continuous'; |
|
|
1739 |
else datasettype = 'epoched'; |
|
|
1740 |
end |
|
|
1741 |
|
|
|
1742 |
% number of channels and channel locations |
|
|
1743 |
% ---------------------------------------- |
|
|
1744 |
chanlen = unique_bc( [ EEG.nbchan ] ); |
|
|
1745 |
chanlenstr = vararg2str( mattocell(chanlen) ); |
|
|
1746 |
anyempty = unique_bc( cellfun( 'isempty', { EEG.chanlocs }) ); |
|
|
1747 |
if length(anyempty) == 2, chanlocs = 'mixed, yes and no'; |
|
|
1748 |
elseif anyempty == 0, chanlocs = 'yes'; |
|
|
1749 |
else chanlocs = 'no'; |
|
|
1750 |
end |
|
|
1751 |
|
|
|
1752 |
% ica weights |
|
|
1753 |
% ----------- |
|
|
1754 |
anyempty = unique_bc( cellfun( 'isempty', { EEG.icaweights }) ); |
|
|
1755 |
if length(anyempty) == 2, studystatus = 'Missing ICA dec.'; |
|
|
1756 |
elseif anyempty == 0, studystatus = 'Ready to precluster'; |
|
|
1757 |
else studystatus = 'Missing ICA dec.'; |
|
|
1758 |
end |
|
|
1759 |
|
|
|
1760 |
% consistency && other parameters |
|
|
1761 |
% ------------------------------ |
|
|
1762 |
[EEG, epochconsist] = eeg_checkset(EEG, 'epochconsist'); % epoch consistency |
|
|
1763 |
[EEG, chanconsist ] = eeg_checkset(EEG, 'chanconsist'); % channel consistency |
|
|
1764 |
[EEG, icaconsist ] = eeg_checkset(EEG, 'icaconsist'); % ICA consistency |
|
|
1765 |
totevents = num2str(sum( cellfun( 'length', { EEG.event }) )); % total number of events |
|
|
1766 |
totsize = whos('STUDY', 'ALLEEG'); % total size |
|
|
1767 |
if isempty(STUDY.session), sessionstr = ''; else sessionstr = vararg2str(STUDY.session); end |
|
|
1768 |
if isempty(STUDY.condition), condstr = ''; else condstr = vararg2str(STUDY.condition); end |
|
|
1769 |
|
|
|
1770 |
% determine study status |
|
|
1771 |
% ---------------------- |
|
|
1772 |
if isfield(STUDY.etc, 'preclust') |
|
|
1773 |
if ~isempty( STUDY.etc.preclust ) |
|
|
1774 |
studystatus = 'Pre-clustered'; |
|
|
1775 |
elseif length(STUDY.cluster) > 1 |
|
|
1776 |
studystatus = 'Clustered'; |
|
|
1777 |
end |
|
|
1778 |
elseif length(STUDY.cluster) > 1 |
|
|
1779 |
studystatus = 'Clustered'; |
|
|
1780 |
end |
|
|
1781 |
|
|
|
1782 |
% text |
|
|
1783 |
% ---- |
|
|
1784 |
set( g.win2, 'String', 'Study task name'); |
|
|
1785 |
set( g.win3, 'String', 'Nb of subjects'); |
|
|
1786 |
set( g.win4, 'String', 'Nb of conditions'); |
|
|
1787 |
set( g.win5, 'String', 'Nb of sessions'); |
|
|
1788 |
set( g.win6, 'String', 'Nb of groups'); |
|
|
1789 |
set( g.win7, 'String', 'Epoch consistency'); |
|
|
1790 |
set( g.win8, 'String', 'Channels per frame'); |
|
|
1791 |
set( g.win9, 'String', 'Channel locations'); |
|
|
1792 |
set( g.win10, 'String', 'Clusters'); |
|
|
1793 |
set( g.win11, 'String', 'Status'); |
|
|
1794 |
set( g.win12, 'String', 'Total size (Mb)'); |
|
|
1795 |
|
|
|
1796 |
% values |
|
|
1797 |
% ------ |
|
|
1798 |
fullfilename = fullfile( STUDY.filepath, STUDY.filename); |
|
|
1799 |
if length(fullfilename) > 26 |
|
|
1800 |
set( g.win1, 'String', sprintf('Study filename: ...%s\n', fullfilename(max(1,length(fullfilename)-26):end) )); |
|
|
1801 |
else |
|
|
1802 |
set( g.win1, 'String', sprintf('Study filename: %s\n' , fullfilename)); |
|
|
1803 |
end |
|
|
1804 |
condconsist = std_checkconsist(STUDY, 'uniform', 'condition'); |
|
|
1805 |
groupconsist = std_checkconsist(STUDY, 'uniform', 'group'); |
|
|
1806 |
sessconsist = std_checkconsist(STUDY, 'uniform', 'session'); |
|
|
1807 |
txtcond = fastif(condconsist , ' per subject', ' (some missing)'); |
|
|
1808 |
txtgroup = fastif(groupconsist, ' per subject', ' (some missing)'); |
|
|
1809 |
txtsess = fastif(sessconsist , ' per subject', ' (some missing)'); |
|
|
1810 |
set( g.val2, 'String', STUDY.task); |
|
|
1811 |
set( g.val3, 'String', int2str(max(1, length(STUDY.subject)))); |
|
|
1812 |
set( g.val4, 'String', [ int2str(max(1, length(STUDY.condition))) txtcond ]); |
|
|
1813 |
set( g.val5, 'String', [ int2str(max(1, length(STUDY.session))) txtsess ]); |
|
|
1814 |
set( g.val6, 'String', [ int2str(max(1, length(STUDY.group))) txtgroup ]); |
|
|
1815 |
set( g.val7, 'String', char(epochconsist)); |
|
|
1816 |
set( g.val8, 'String', char(chanlenstr)); |
|
|
1817 |
set( g.val9, 'String', char(chanlocs)); |
|
|
1818 |
set( g.val10, 'String', num2str(length(STUDY.cluster))); |
|
|
1819 |
set( g.val11, 'String', char(studystatus)); |
|
|
1820 |
set( g.val12, 'String', num2str(round(sum( [ totsize.bytes] )/1E6*10)/10)); |
|
|
1821 |
|
|
|
1822 |
elseif (exist('EEG') == 1) && ~isnumeric(EEG) && ~isempty(EEG(1).data) |
|
|
1823 |
|
|
|
1824 |
hh = findobj('parent', gcf, 'userdata', 'fullline'); set(hh, 'visible', 'off'); |
|
|
1825 |
hh = findobj('parent', gcf, 'userdata', 'datinfo'); set(hh, 'visible', 'on'); |
|
|
1826 |
|
|
|
1827 |
if length(EEG) > 1 % several datasets |
|
|
1828 |
|
|
|
1829 |
menustatus = { menustatus{:} 'multiple_datasets' }; |
|
|
1830 |
|
|
|
1831 |
% head string |
|
|
1832 |
% ----------- |
|
|
1833 |
strsetnum = 'Datasets '; |
|
|
1834 |
for i = CURRENTSET |
|
|
1835 |
strsetnum = [ strsetnum int2str(i) ',' ]; |
|
|
1836 |
end |
|
|
1837 |
strsetnum = strsetnum(1:end-1); |
|
|
1838 |
set( g.win0, 'String', strsetnum); |
|
|
1839 |
|
|
|
1840 |
% dataset type |
|
|
1841 |
% ------------ |
|
|
1842 |
datasettype = unique_bc( [ EEG.trials ] ); |
|
|
1843 |
if datasettype(1) == 1 && length(datasettype) == 1, datasettype = 'continuous'; |
|
|
1844 |
elseif datasettype(1) == 1, datasettype = 'epoched and continuous'; |
|
|
1845 |
else datasettype = 'epoched'; |
|
|
1846 |
end |
|
|
1847 |
|
|
|
1848 |
% number of channels and channel locations |
|
|
1849 |
% ---------------------------------------- |
|
|
1850 |
chanlen = unique_bc( [ EEG.nbchan ] ); |
|
|
1851 |
chanlenstr = vararg2str( mattocell(chanlen) ); |
|
|
1852 |
anyempty = unique_bc( cellfun( 'isempty', { EEG.chanlocs }) ); |
|
|
1853 |
if length(anyempty) == 2, chanlocs = 'mixed, yes and no'; |
|
|
1854 |
elseif anyempty == 0, chanlocs = 'yes'; |
|
|
1855 |
else chanlocs = 'no'; |
|
|
1856 |
end |
|
|
1857 |
|
|
|
1858 |
% ica weights |
|
|
1859 |
% ----------- |
|
|
1860 |
anyempty = unique_bc( cellfun( 'isempty', { EEG.icaweights }) ); |
|
|
1861 |
if length(anyempty) == 2, icaweights = 'mixed, yes and no'; |
|
|
1862 |
elseif anyempty == 0, icaweights = 'yes'; |
|
|
1863 |
else icaweights = 'no'; |
|
|
1864 |
end |
|
|
1865 |
|
|
|
1866 |
% consistency & other parameters |
|
|
1867 |
% ------------------------------ |
|
|
1868 |
[EEG, epochconsist] = eeg_checkset(EEG, 'epochconsist'); % epoch consistency |
|
|
1869 |
[EEG, chanconsist ] = eeg_checkset(EEG, 'chanconsist'); % channel consistency |
|
|
1870 |
[EEG, icaconsist ] = eeg_checkset(EEG, 'icaconsist'); % ICA consistency |
|
|
1871 |
totevents = num2str(sum( cellfun( 'length', { EEG.event }) )); % total number of events |
|
|
1872 |
srate = vararg2str( mattocell( unique( [ EEG.srate ] ) )); % sampling rate |
|
|
1873 |
totsize = whos('EEG'); % total size |
|
|
1874 |
|
|
|
1875 |
% text |
|
|
1876 |
% ---- |
|
|
1877 |
set( g.win2, 'String', 'Number of datasets'); |
|
|
1878 |
set( g.win3, 'String', 'Dataset type'); |
|
|
1879 |
set( g.win4, 'String', 'Epoch consistency'); |
|
|
1880 |
set( g.win5, 'String', 'Channels per frame'); |
|
|
1881 |
set( g.win6, 'String', 'Channel consistency'); |
|
|
1882 |
set( g.win7, 'String', 'Channel locations'); |
|
|
1883 |
set( g.win8, 'String', 'Events (total)'); |
|
|
1884 |
set( g.win9, 'String', 'Sampling rate (Hz)'); |
|
|
1885 |
set( g.win10, 'String', 'ICA weights'); |
|
|
1886 |
set( g.win11, 'String', 'Identical ICA'); |
|
|
1887 |
set( g.win12, 'String', 'Total size (Mb)'); |
|
|
1888 |
|
|
|
1889 |
% values |
|
|
1890 |
% ------ |
|
|
1891 |
set( g.win1, 'String', sprintf('Groupname: -(soon)-\n')); |
|
|
1892 |
set( g.val2, 'String', int2str(length(EEG))); |
|
|
1893 |
set( g.val3, 'String', char(datasettype)); |
|
|
1894 |
set( g.val4, 'String', char(epochconsist)); |
|
|
1895 |
set( g.val5, 'String', char(chanlenstr)); |
|
|
1896 |
set( g.val6, 'String', char(chanconsist)); |
|
|
1897 |
set( g.val7, 'String', char(chanlocs)); |
|
|
1898 |
set( g.val8, 'String', char(totevents)); |
|
|
1899 |
set( g.val9, 'String', char(srate)); |
|
|
1900 |
set( g.val10, 'String', char(icaweights)); |
|
|
1901 |
set( g.val11, 'String', char(icaconsist)); |
|
|
1902 |
set( g.val12, 'String', num2str(round(totsize.bytes/1E6*10)/10)); |
|
|
1903 |
|
|
|
1904 |
else % one continuous dataset selected |
|
|
1905 |
|
|
|
1906 |
menustatus = { menustatus{:} 'continuous_dataset' }; |
|
|
1907 |
|
|
|
1908 |
% text |
|
|
1909 |
% ---- |
|
|
1910 |
set( g.win2, 'String', 'Channels per frame'); |
|
|
1911 |
set( g.win3, 'String', 'Frames per epoch'); |
|
|
1912 |
set( g.win4, 'String', 'Epochs'); |
|
|
1913 |
set( g.win5, 'String', 'Events'); |
|
|
1914 |
set( g.win6, 'String', 'Sampling rate (Hz)'); |
|
|
1915 |
set( g.win7, 'String', 'Epoch start (sec)'); |
|
|
1916 |
set( g.win8, 'String', 'Epoch end (sec)'); |
|
|
1917 |
set( g.win9, 'String', 'Reference'); |
|
|
1918 |
set( g.win10, 'String', 'Channel locations'); |
|
|
1919 |
set( g.win11, 'String', 'ICA weights'); |
|
|
1920 |
set( g.win12, 'String', 'Dataset size (Mb)'); |
|
|
1921 |
|
|
|
1922 |
if CURRENTSET == 0, strsetnum = ''; |
|
|
1923 |
else strsetnum = ['#' int2str(CURRENTSET) ': ']; |
|
|
1924 |
end |
|
|
1925 |
maxchar = 28; |
|
|
1926 |
if ~isempty( EEG.setname ) |
|
|
1927 |
if length(EEG.setname) > maxchar+2 |
|
|
1928 |
set( g.win0, 'String', [strsetnum EEG.setname(1:min(maxchar,length(EEG.setname))) '...' ]); |
|
|
1929 |
else set( g.win0, 'String', [strsetnum EEG.setname ]); |
|
|
1930 |
end |
|
|
1931 |
else |
|
|
1932 |
set( g.win0, 'String', [strsetnum '(no dataset name)' ] ); |
|
|
1933 |
end |
|
|
1934 |
|
|
|
1935 |
fullfilename = fullfile(EEG.filepath, EEG.filename); |
|
|
1936 |
if ~isempty(fullfilename) |
|
|
1937 |
if length(fullfilename) > 26 |
|
|
1938 |
set( g.win1, 'String', sprintf('Filename: ...%s\n', fullfilename(max(1,length(fullfilename)-26):end) )); |
|
|
1939 |
else |
|
|
1940 |
set( g.win1, 'String', sprintf('Filename: %s\n', fullfilename)); |
|
|
1941 |
end |
|
|
1942 |
else |
|
|
1943 |
set( g.win1, 'String', sprintf('Filename: none\n')); |
|
|
1944 |
end |
|
|
1945 |
|
|
|
1946 |
set( g.val2, 'String', int2str(fastif(isempty(EEG.data), 0, size(EEG.data,1)))); |
|
|
1947 |
set( g.val3, 'String', int2str(EEG.pnts)); |
|
|
1948 |
set( g.val4, 'String', int2str(EEG.trials)); |
|
|
1949 |
set( g.val5, 'String', fastif(isempty(EEG.event), 'none', int2str(length(EEG.event)))); |
|
|
1950 |
set( g.val6, 'String', int2str( round(EEG.srate)) ); |
|
|
1951 |
if round(EEG.xmin) == EEG.xmin && round(EEG.xmax) == EEG.xmax |
|
|
1952 |
set( g.val7, 'String', sprintf('%d\n', EEG.xmin)); |
|
|
1953 |
set( g.val8, 'String', sprintf('%d\n', EEG.xmax)); |
|
|
1954 |
else |
|
|
1955 |
set( g.val7, 'String', sprintf('%6.3f\n', EEG.xmin)); |
|
|
1956 |
set( g.val8, 'String', sprintf('%6.3f\n', EEG.xmax)); |
|
|
1957 |
end |
|
|
1958 |
|
|
|
1959 |
% reference |
|
|
1960 |
if isfield(EEG(1).chanlocs, 'ref') |
|
|
1961 |
[curref, ~, allinds] = unique_bc( { EEG(1).chanlocs.ref }); |
|
|
1962 |
maxind = 1; |
|
|
1963 |
for ind = unique_bc(allinds) |
|
|
1964 |
if length(find(allinds == ind)) > length(find(allinds == maxind)) |
|
|
1965 |
maxind = ind; |
|
|
1966 |
end |
|
|
1967 |
end |
|
|
1968 |
curref = curref{maxind}; |
|
|
1969 |
if isempty(curref), curref = 'unknown'; end |
|
|
1970 |
else curref = 'unknown'; |
|
|
1971 |
end |
|
|
1972 |
set( g.val9, 'String', curref); |
|
|
1973 |
if isempty(EEG.chanlocs) |
|
|
1974 |
set( g.val10, 'String', 'No'); |
|
|
1975 |
else |
|
|
1976 |
if ~isfield(EEG.chanlocs, 'theta') || all(cellfun('isempty', { EEG.chanlocs.theta })) |
|
|
1977 |
set( g.val10, 'String', 'No (labels only)'); |
|
|
1978 |
else |
|
|
1979 |
set( g.val10, 'String', 'Yes'); |
|
|
1980 |
end |
|
|
1981 |
end |
|
|
1982 |
|
|
|
1983 |
set( g.val11, 'String', fastif(isempty(EEG.icasphere), 'No', 'Yes')); |
|
|
1984 |
tmp = whos('EEG'); |
|
|
1985 |
if ~isa(EEG.data, 'memmapdata') && ~isa(EEG.data, 'mmo') |
|
|
1986 |
set( g.val12, 'String', num2str(round(tmp.bytes/1E6*10)/10)); |
|
|
1987 |
else |
|
|
1988 |
set( g.val12, 'String', [ num2str(round(tmp.bytes/1E6*10)/10) ' (file mapped)' ]); |
|
|
1989 |
end |
|
|
1990 |
|
|
|
1991 |
if EEG.trials > 1 || EEG.xmin ~= 0 |
|
|
1992 |
menustatus = { menustatus{:} 'epoched_dataset' }; |
|
|
1993 |
else |
|
|
1994 |
menustatus = { menustatus{:} 'continuous_dataset' }; |
|
|
1995 |
end |
|
|
1996 |
if ~isfield(EEG.chanlocs, 'theta') |
|
|
1997 |
menustatus = { menustatus{:} 'chanloc_absent' }; |
|
|
1998 |
end |
|
|
1999 |
if isempty(EEG.icaweights) |
|
|
2000 |
menustatus = { menustatus{:} 'ica_absent' }; |
|
|
2001 |
end |
|
|
2002 |
end |
|
|
2003 |
else |
|
|
2004 |
menustatus = { 'startup' }; |
|
|
2005 |
|
|
|
2006 |
hh = findobj('parent', gcf, 'userdata', 'fullline'); set(hh, 'visible', 'on'); |
|
|
2007 |
hh = findobj('parent', gcf, 'userdata', 'datinfo'); set(hh, 'visible', 'off'); |
|
|
2008 |
set( g.win0, 'String', 'No current dataset'); |
|
|
2009 |
set( g.mainwin0, 'String', 'Suggested steps to get started', 'fontweight', 'bold'); |
|
|
2010 |
set( g.mainwin1, 'String', '- Create a new or load an existing dataset:'); |
|
|
2011 |
set( g.mainwin2, 'String', ' Use "File > Import data" (new)'); |
|
|
2012 |
set( g.mainwin3, 'String', ' Or "File > Load existing dataset" (load)'); |
|
|
2013 |
set( g.mainwin4, 'String', ' (find tutorial data in sample_data folder)'); |
|
|
2014 |
set( g.mainwin5, 'String', '- If newly imported raw dataset'); |
|
|
2015 |
set( g.mainwin6, 'String', ' "Edit > Channel locations" (look up locations)'); |
|
|
2016 |
set( g.mainwin7, 'String', ' "File > Import event info" (for continuous data)'); |
|
|
2017 |
set( g.mainwin8, 'String', '- Filter data: "Tools > Filter data"'); |
|
|
2018 |
set( g.mainwin9, 'String', '- Reject data: "Tools > Reject data by eye"'); |
|
|
2019 |
set( g.mainwin10,'String', '- Run ICA: "Tools > Run ICA" (can take time)'); |
|
|
2020 |
set( g.mainwin11,'String', '- Reject by ICA: "Tools > Reject data using ICA"'); |
|
|
2021 |
set( g.mainwin12,'String', '- Epoch data: "Tools > Extract epochs"'); |
|
|
2022 |
set( g.mainwin13,'String', '- Plot ERP: "Plot > Channel ERP > In scalp array"'); |
|
|
2023 |
end |
|
|
2024 |
|
|
|
2025 |
% ERPLAB |
|
|
2026 |
if exist('ALLERP') == 1 && ~isempty(ALLERP) |
|
|
2027 |
menustatus = { menustatus{:} 'erp_dataset' }; |
|
|
2028 |
end |
|
|
2029 |
|
|
|
2030 |
if exist('ALLBEST') == 1 && ~isempty(ALLBEST) |
|
|
2031 |
menustatus = { menustatus{:} 'best_dataset' }; |
|
|
2032 |
end |
|
|
2033 |
|
|
|
2034 |
if exist('ALLMVPC') == 1 && ~isempty(ALLMVPC) |
|
|
2035 |
menustatus = { menustatus{:} 'mvpc_dataset'}; |
|
|
2036 |
end |
|
|
2037 |
|
|
|
2038 |
% enable selected menu items |
|
|
2039 |
% -------------------------- |
|
|
2040 |
allmenus = findobj( W_MAIN, 'type', 'uimenu'); |
|
|
2041 |
allstrs = get(allmenus, 'userdata'); |
|
|
2042 |
if any(strcmp(menustatus, 'startup')) |
|
|
2043 |
|
|
|
2044 |
set(allmenus, 'enable', 'on'); |
|
|
2045 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''startup:off''))), allstrs);'); |
|
|
2046 |
set(allmenus(indmatchvar), 'enable', 'off'); |
|
|
2047 |
|
|
|
2048 |
elseif any(strcmp(menustatus, 'study')) |
|
|
2049 |
|
|
|
2050 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''study:on''))), allstrs);'); |
|
|
2051 |
set(allmenus , 'enable', 'off'); |
|
|
2052 |
set(allmenus(indmatchvar), 'enable', 'on'); |
|
|
2053 |
|
|
|
2054 |
elseif any(strcmp(menustatus, 'multiple_datasets')) |
|
|
2055 |
|
|
|
2056 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''study:on''))), allstrs);'); |
|
|
2057 |
set(allmenus , 'enable', 'off'); |
|
|
2058 |
set(allmenus(indmatchvar), 'enable', 'on'); |
|
|
2059 |
set(findobj('parent', W_MAIN, 'label', 'Study'), 'enable', 'off'); |
|
|
2060 |
|
|
|
2061 |
% -------------------------------- |
|
|
2062 |
% Javier Lopez-Calderon for ERPLAB |
|
|
2063 |
elseif any(strcmp(menustatus, 'epoched_dataset')) |
|
|
2064 |
|
|
|
2065 |
set(allmenus, 'enable', 'on'); |
|
|
2066 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''epoch:off''))), allstrs);'); |
|
|
2067 |
set(allmenus(indmatchvar), 'enable', 'off'); |
|
|
2068 |
% end, Javier Lopez-Calderon for ERPLAB |
|
|
2069 |
% -------------------------------- |
|
|
2070 |
elseif any(strcmp(menustatus, 'continuous_dataset')) |
|
|
2071 |
|
|
|
2072 |
set(allmenus, 'enable', 'on'); |
|
|
2073 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''continuous:off''))), allstrs);'); |
|
|
2074 |
set(allmenus(indmatchvar), 'enable', 'off'); |
|
|
2075 |
|
|
|
2076 |
|
|
|
2077 |
end |
|
|
2078 |
if any(strcmp(menustatus, 'chanloc_absent')) |
|
|
2079 |
|
|
|
2080 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''chanloc:on''))), allstrs);'); |
|
|
2081 |
set(allmenus(indmatchvar), 'enable', 'off'); |
|
|
2082 |
|
|
|
2083 |
end |
|
|
2084 |
if any(strcmp(menustatus, 'ica_absent')) |
|
|
2085 |
|
|
|
2086 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''ica:on''))), allstrs);'); |
|
|
2087 |
set(allmenus(indmatchvar), 'enable', 'off'); |
|
|
2088 |
|
|
|
2089 |
end |
|
|
2090 |
if any(strcmp(menustatus, 'roi_connect')) |
|
|
2091 |
|
|
|
2092 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''roi:off''))), allstrs);'); |
|
|
2093 |
set(allmenus(indmatchvar), 'enable', 'off'); |
|
|
2094 |
|
|
|
2095 |
end |
|
|
2096 |
|
|
|
2097 |
% always off |
|
|
2098 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''enable:off''))), allstrs);'); |
|
|
2099 |
set(allmenus(indmatchvar), 'enable', 'off'); |
|
|
2100 |
|
|
|
2101 |
% -------------------------------- |
|
|
2102 |
% Javier Lopez-Calderon for ERPLAB |
|
|
2103 |
if any(strcmp(menustatus, 'erp_dataset')) |
|
|
2104 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''erpset:on''))), allstrs);'); |
|
|
2105 |
set(allmenus(indmatchvar), 'enable', 'on'); |
|
|
2106 |
end |
|
|
2107 |
% end, Javier Lopez-Calderon for ERPLAB |
|
|
2108 |
% -------------------------------- |
|
|
2109 |
% -------------------------------- |
|
|
2110 |
% Aaron Matthew Simmons for ERPLAB |
|
|
2111 |
|
|
|
2112 |
if any(strcmp(menustatus, 'best_dataset')) |
|
|
2113 |
set(allmenus, 'enable', 'on'); |
|
|
2114 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''bestset:off''))), allstrs);'); |
|
|
2115 |
set(allmenus(indmatchvar), 'enable', 'off'); |
|
|
2116 |
end |
|
|
2117 |
if any(strcmp(menustatus, 'mvpc_dataset')) |
|
|
2118 |
set(allmenus, 'enable', 'on'); |
|
|
2119 |
eval('indmatchvar = cellfun(@(x)(~isempty(findstr(num2str(x), ''mvpcset:off''))), allstrs);'); |
|
|
2120 |
set(allmenus(indmatchvar), 'enable', 'off'); |
|
|
2121 |
end |
|
|
2122 |
% end, Aaron Matthew Simmons for ERPLAB |
|
|
2123 |
|
|
|
2124 |
|
|
|
2125 |
% adjust title extent |
|
|
2126 |
% ------------------- |
|
|
2127 |
poswin0 = get(g.win0, 'position'); |
|
|
2128 |
extwin0 = get(g.win0, 'extent'); |
|
|
2129 |
set(g.win0, 'position', [poswin0(1:2) extwin0(3) extwin0(4)]); |
|
|
2130 |
|
|
|
2131 |
% adjust all font sizes (RMC fix MATLAB 2014 compatibility) |
|
|
2132 |
% ------------------- |
|
|
2133 |
% icadefs; |
|
|
2134 |
% handlesname = fieldnames(g); |
|
|
2135 |
% for i = 1:length(handlesname) |
|
|
2136 |
% if isprop(eval(['g.' handlesname{i}]),'Style') && ~strcmp(handlesname{i},'win0') |
|
|
2137 |
% propval = get(eval(['g.' handlesname{i}]), 'Style'); |
|
|
2138 |
% if strcmp(propval,'text') |
|
|
2139 |
% set(eval(['g.' handlesname{i}]),'FontSize',TEXT_FONTSIZE); |
|
|
2140 |
% end |
|
|
2141 |
% end |
|
|
2142 |
% end |
|
|
2143 |
|
|
|
2144 |
return; |
|
|
2145 |
|
|
|
2146 |
function num = popask( text ) |
|
|
2147 |
ButtonName=questdlg2( text, ... |
|
|
2148 |
'Confirmation', 'Cancel', 'Yes','Yes'); |
|
|
2149 |
switch lower(ButtonName), |
|
|
2150 |
case 'cancel', num = 0; |
|
|
2151 |
case 'yes', num = 1; |
|
|
2152 |
end |
|
|
2153 |
|
|
|
2154 |
function g = myguihandles(fig) |
|
|
2155 |
g = []; |
|
|
2156 |
hh = findobj('parent', gcf); |
|
|
2157 |
for index = 1:length(hh) |
|
|
2158 |
if ~isempty(get(hh(index), 'tag')) |
|
|
2159 |
g = setfield(g, get(hh(index), 'tag'), hh(index)); |
|
|
2160 |
end |
|
|
2161 |
end |
|
|
2162 |
|
|
|
2163 |
|
|
|
2164 |
function rmpathifpresent(newpath) |
|
|
2165 |
comp = computer; |
|
|
2166 |
if strcmpi(comp(1:2), 'PC') |
|
|
2167 |
newpath = [ newpath ';' ]; |
|
|
2168 |
else |
|
|
2169 |
newpath = [ newpath ':' ]; |
|
|
2170 |
end |
|
|
2171 |
p = path; |
|
|
2172 |
ind = strfind(p, newpath); |
|
|
2173 |
if ~isempty(ind) |
|
|
2174 |
rmpath(newpath); |
|
|
2175 |
end |
|
|
2176 |
|
|
|
2177 |
% add path only if it is not already in the list |
|
|
2178 |
% ---------------------------------------------- |
|
|
2179 |
function addpathifnotinlist(newpath) |
|
|
2180 |
|
|
|
2181 |
comp = computer; |
|
|
2182 |
if strcmpi(comp(1:2), 'PC') |
|
|
2183 |
newpathtest = [ newpath ';' ]; |
|
|
2184 |
else |
|
|
2185 |
newpathtest = [ newpath ':' ]; |
|
|
2186 |
end |
|
|
2187 |
p = path; |
|
|
2188 |
ind = strfind(p, newpathtest); |
|
|
2189 |
if isempty(ind) |
|
|
2190 |
if exist(newpath) == 7 |
|
|
2191 |
addpath(newpath); |
|
|
2192 |
end |
|
|
2193 |
end |
|
|
2194 |
|
|
|
2195 |
function addpathifnotexist(newpath, functionname) |
|
|
2196 |
tmpp = mywhich(functionname); |
|
|
2197 |
|
|
|
2198 |
if isempty(tmpp) |
|
|
2199 |
addpath(newpath); |
|
|
2200 |
end |
|
|
2201 |
|
|
|
2202 |
% find a function path and add path if not present |
|
|
2203 |
% ------------------------------------------------ |
|
|
2204 |
function myaddpath(eeglabpath, functionname, pathtoadd) |
|
|
2205 |
|
|
|
2206 |
tmpp = mywhich(functionname); |
|
|
2207 |
tmpnewpath = [ eeglabpath pathtoadd ]; |
|
|
2208 |
if ~isempty(tmpp) |
|
|
2209 |
tmpp = tmpp(1:end-length(functionname)); |
|
|
2210 |
if length(tmpp) > length(tmpnewpath), tmpp = tmpp(1:end-1); end % remove trailing filesep |
|
|
2211 |
if length(tmpp) > length(tmpnewpath), tmpp = tmpp(1:end-1); end % remove trailing filesep |
|
|
2212 |
%disp([ tmpp ' || ' tmpnewpath '(' num2str(~strcmpi(tmpnewpath, tmpp)) ')' ]); |
|
|
2213 |
if ~strcmpi(tmpnewpath, tmpp) |
|
|
2214 |
warning('off', 'MATLAB:dispatcher:nameConflict'); |
|
|
2215 |
addpath(tmpnewpath); |
|
|
2216 |
warning('on', 'MATLAB:dispatcher:nameConflict'); |
|
|
2217 |
end |
|
|
2218 |
else |
|
|
2219 |
%disp([ 'Adding new path ' tmpnewpath ]); |
|
|
2220 |
addpathifnotinlist(tmpnewpath); |
|
|
2221 |
end |
|
|
2222 |
|
|
|
2223 |
% parse plugin function name |
|
|
2224 |
% -------------------------- |
|
|
2225 |
function [name, vers] = parsepluginname(dirName, funcname) |
|
|
2226 |
ind = find( dirName >= '0' & dirName <= '9' ); |
|
|
2227 |
if isempty(ind) |
|
|
2228 |
name = dirName; |
|
|
2229 |
vers = ''; |
|
|
2230 |
else |
|
|
2231 |
ind = length(dirName); |
|
|
2232 |
while ind > 0 && ((dirName(ind) >= '0' && dirName(ind) <= '9') || dirName(ind) == '.' || dirName(ind) == '_') |
|
|
2233 |
ind = ind - 1; |
|
|
2234 |
end |
|
|
2235 |
name = dirName(1:ind); |
|
|
2236 |
vers = dirName(ind+1:end); |
|
|
2237 |
vers(vers == '_') = '.'; |
|
|
2238 |
if ~isempty(vers) |
|
|
2239 |
if vers(1) == '.', vers(1) = []; end |
|
|
2240 |
end |
|
|
2241 |
end |
|
|
2242 |
|
|
|
2243 |
% check with function name and change version if necessary (for loadhdf5) |
|
|
2244 |
if nargin > 1 && ~isempty(strfind(dirName, funcname)) |
|
|
2245 |
name1 = funcname; |
|
|
2246 |
vers2 = dirName(length(funcname)+1:end); |
|
|
2247 |
if ~isempty(vers2) |
|
|
2248 |
vers2(vers2 == '_') = '.'; |
|
|
2249 |
if ~isequal(vers, vers2) ... % differebt versions |
|
|
2250 |
&& (vers2(1) >= '0' && vers2(1) <= '9') % version 2 is numerical |
|
|
2251 |
vers = vers2; |
|
|
2252 |
end |
|
|
2253 |
end |
|
|
2254 |
end |
|
|
2255 |
|
|
|
2256 |
% required here because path not added yet |
|
|
2257 |
% to the admin folder |
|
|
2258 |
function res = ismatlab |
|
|
2259 |
|
|
|
2260 |
res = exist('OCTAVE_VERSION', 'builtin') == 0; |
|
|
2261 |
|
|
|
2262 |
function res = mywhich(varargin) |
|
|
2263 |
try |
|
|
2264 |
res = which(varargin{:}); |
|
|
2265 |
catch |
|
|
2266 |
fprintf('Warning: permission error accessing %s\n', varargin{1}); |
|
|
2267 |
end |
|
|
2268 |
|
|
|
2269 |
function h = eegmenu( versL, varargin) |
|
|
2270 |
h = []; |
|
|
2271 |
if ~versL |
|
|
2272 |
h = uimenu(varargin{:}); |
|
|
2273 |
end |
|
|
2274 |
|