|
139 | 139 |
|
140 | 140 | function [ALLEEG, EEG, CURRENTSET, ALLCOM] = eeglab( onearg )
|
141 | 141 |
|
| 142 | +% BCILAB specific --------------- |
| 143 | + |
| 144 | +% check for duplicate versions of EEGLAB |
| 145 | +% -------------------------------------- |
| 146 | +eeglabpath = mywhich('eeglab.m'); |
| 147 | +eeglabpath = eeglabpath(1:end-length('eeglab.m')); |
| 148 | +dbstackval = dbstack; |
| 149 | +if nargin < 1 && length(dbstackval) < 2 |
| 150 | + eeglabpath2 = ''; |
| 151 | + if strcmpi(eeglabpath, pwd) || strcmpi(eeglabpath(1:end-1), pwd) |
| 152 | + cd('functions'); |
| 153 | + warning('off', 'MATLAB:rmpath:DirNotFound'); |
| 154 | + rmpath(eeglabpath); |
| 155 | + warning('on', 'MATLAB:rmpath:DirNotFound'); |
| 156 | + eeglabpath2 = mywhich('eeglab.m'); |
| 157 | + cd('..'); |
| 158 | + else |
| 159 | + try, rmpath(eeglabpath); catch, end; |
| 160 | + eeglabpath2 = mywhich('eeglab.m'); |
| 161 | + end; |
| 162 | + if ~isempty(eeglabpath2) |
| 163 | + eeglabpath2 = eeglabpath2(1:end-length('eeglab.m')); |
| 164 | + disp('******************************************************'); |
| 165 | + disp('There are two versions of EEGLAB in your path'); |
| 166 | + disp(sprintf('(1) One is at %s', eeglabpath)); |
| 167 | + disp(sprintf('(2) The other one is at %s', eeglabpath2)); |
| 168 | + %disp('To remove this message, simply delete or remove one of the EEGLAB version from the Matlab path'); |
| 169 | + s = input('Which version do you want to use (enter "1" or "2" then press enter)? '); |
| 170 | + |
| 171 | + % starting other version of eeglab |
| 172 | + if ~isempty(s) && s(1) == 2 |
| 173 | + tmpp = path; |
| 174 | + indcolom = [0 find(tmpp == ':') length(tmpp)+1]; |
| 175 | + for ind = 1:length(indcolom)-1 |
| 176 | + currentpath = tmpp(indcolom(ind)+1:indcolom(ind+1)-1); |
| 177 | + if ~isempty(findstr('eeglab', currentpath)) |
| 178 | + disp([ 'Removing path ' currentpath ]); |
| 179 | + rmpath(currentpath); |
| 180 | + end; |
| 181 | + end; |
| 182 | + cd(eeglabpath2); |
| 183 | + eeglab; |
| 184 | + return; |
| 185 | + else |
| 186 | + disp(sprintf('Using the EEGLAB version at %s', eeglabpath)); |
| 187 | + end; |
| 188 | + end; |
| 189 | + addpath(eeglabpath); |
| 190 | +end; |
| 191 | + |
| 192 | +% BCILAB specific --------------- |
| 193 | + |
142 | 194 | % add the paths
|
143 | 195 | % -------------
|
144 | 196 | warning('off', 'dispatcher:nameConflict');
|
|
162 | 214 | warning('EEGLAB subfolders not found');
|
163 | 215 | end;
|
164 | 216 | end;
|
165 |
| -OPT_FOLDER = which('eeg_options'); |
166 |
| -OPT_FOLDER = fileparts( OPT_FOLDER ); |
167 | 217 |
|
168 | 218 | % determine file format
|
169 | 219 | % ---------------------
|
|
192 | 242 | myaddpath( eeglabpath, 'eeglab1020.ced', [ 'functions' filesep 'resources' ]);
|
193 | 243 | myaddpath( eeglabpath, 'eegplugin_dipfit', 'plugins');
|
194 | 244 | end;
|
| 245 | +OPT_FOLDER = which('eeg_options'); |
| 246 | +OPT_FOLDER = fileparts( OPT_FOLDER ); |
195 | 247 |
|
196 | 248 | eeglab_options;
|
197 | 249 |
|
@@ -1701,4 +1753,12 @@ function addpathexist(p)
|
1701 | 1753 | else val = 0;
|
1702 | 1754 | end;
|
1703 | 1755 |
|
| 1756 | + |
| 1757 | +function res = mywhich(varargin); |
| 1758 | +try |
| 1759 | + res = which(varargin{:}); |
| 1760 | +catch |
| 1761 | + fprintf('Warning: permission error accesssing %s\n', varargin{1}); |
| 1762 | +end; |
| 1763 | + |
1704 | 1764 | function buildhelpmenu;
|
0 commit comments