<div dir="ltr"><div dir="ltr">Hi everyone,<div><br></div><div>I have been running into this error with AMICA on mac Sierra 10.12.6 using EEGLAB version 14_1_2b. Most of time it works just fine, but then on some files it fails and I can't figure out why. The files on which it fails don't seem to be different in any observable way. I installed AMICA through the GUI, and I have tried uninstalling and reinstalling to no avail.</div><div><br></div><div>I'm hoping one of you can help.</div><div><br></div><div>My script was adapted from <a href="https://sccn.ucsd.edu/wiki/Makoto's_useful_EEGLAB_code">Makato's script </a>and is as follows (no spaces in path):</div><div><br></div><div><br></div><div><div>for iFile = iFiles</div><div>           </div><div>          disp(['starting subject' currentSub 'file' num2str(iFile)])</div><div>  </div><div>          curoutfname = ['S' currentSub '0' num2str(iFile)  'postASRpostICA.set'];</div><div>          </div><div>          cutfulloutputfname = fullfile(postICAdir,curoutfname); % so we can check if an output file exists already (so we can potentially bail on this iteration of a loop so we don't redo work)</div><div><br></div><div>          if exist(cutfulloutputfname,'file')</div><div>              disp(['File ' cutfulloutputfname ' already exists, bailing...'])</div><div>              continue % break? </div><div>          end</div><div>          </div><div>            %reload to clear</div><div>            eeglab</div><div>            </div><div>            EEG = pop_loadset('filename',['S' currentSub '0' num2str(iFile)  'postASRpreICA.set'],'filepath',preICAdir);</div><div>            </div><div>            %  Run AMICA using calculated data rank with 'pcakeep' option</div><div>            if isfield(EEG.etc, 'clean_channel_mask')</div><div>                dataRank = min([rank(double(EEG.data')) sum(EEG.etc.clean_channel_mask)]);</div><div>            else</div><div>                dataRank = rank(double(EEG.data'));</div><div>            end</div><div>            amicaoutdir = fullfile(postICAdir,['S' currentSub '0' num2str(iFile)  'amicaout']);</div><div>            runamica15(EEG.data, 'num_chans', EEG.nbchan,...</div><div>                'outdir', amicaoutdir, ... % [ postICAdir '/S' currentSub '0' num2str(iFile)  'amicaout'],...</div><div>                'pcakeep', dataRank, 'num_models', 1,...</div><div>                'do_reject', 1, 'numrej', 15, 'rejsig', 3, 'rejint', 1);</div><div>            EEG.etc.amica  = loadmodout15(amicaoutdir); % fullfile(postICAdir,['S' currentSub '0' num2str(iFile)  'amicaout']));</div><div>            EEG.etc.amica.S = EEG.etc.amica.S(1:EEG.etc.amica.num_pcs, :); % Weirdly, I saw size(S,1) be larger than rank. This process does not hurt anyway.</div><div>            EEG.icaweights = EEG.etc.amica.W;</div><div>            EEG.icasphere  = EEG.etc.amica.S;</div><div>            EEG = eeg_checkset(EEG, 'ica');</div><div>            </div><div>                    </div><div>            EEG = pop_saveset( EEG, 'filename',curoutfname,'filepath', postICAdir);</div><div>           %EEG = pop_saveset( EEG, 'filename',['S' currentSub '0' num2str(iFile)  'postASRpostICA.set'],'filepath', postICAdir);</div><div>            </div><div>            disp(['done with' currentSub 'file' num2str(iFile)])</div><div>     end</div></div></div></div>