Dear Muhammad, If you put the attached function if your SPM folder, this should fix the problem. Best, Vladimir On Mon, Nov 26, 2018 at 3:37 PM Vladimir Litvak <[log in to unmask]> wrote: > Dear Muhammad, > > Please check if this problem is still there for the latest SPM update. If > it is, send me the example file and I will take a look. It would be enough > if you just take the first input dataset and crop it to keep only the Fpz > channel. > > Best, > > Vladimir > > On Sun, Nov 25, 2018 at 4:58 PM Muhammad Adeel Parvaz <[log in to unmask]> > wrote: > >> Hi SPMers, >> >> I have a question about EEG eye-blink correction. I am using the >> following script (after low-passing a continuous eeg file): >> >> *S = [];* >> *S.D = D;* >> *S.mode = 'mark';* >> *S.badchanthresh = 0.2;* >> *S.methods.channels = {'Fpz'};* >> *S.methods.fun = 'eyeblink';* >> *S.methods.settings.threshold = 4;* >> *S.methods.settings.excwin = 0;* >> *S.append = true;* >> *S.prefix = 'a';* >> *D = spm_eeg_artefact(S);* >> *preblinkfile = D.fname;* >> >> *S = [];* >> *S.D = D;* >> *S.timewin = [-500 500];* >> *S.trialdef(1).conditionlabel = 'Eyeblink';* >> *S.trialdef(1).eventtype = 'artefact_eyeblink';* >> *S.trialdef(1).eventvalue = 'Fpz';* >> *S.trialdef(1).trlshift = 0;* >> *S.bc = 0;* >> *S.prefix = 'eyeblink_';* >> *S.eventpadding = 0;* >> *D = spm_eeg_epochs(S);* >> *blinkfile = D.fname;* >> >> *S = [];* >> *S.D = D;* >> *S.mode = 'svd';* >> *S.ncomp = 2;* >> *S.timewin = [-Inf Inf];* >> *D = spm_eeg_spatial_confounds(S);* >> >> *S = [];* >> *S.D = [dirname,'\',preblinkfile];* >> *S.mode = 'spmeeg';* >> *S.conffile = [dirname,'\',blinkfile];* >> *D = spm_eeg_spatial_confounds(S);* >> >> *S = [];* >> *S.D = D;* >> *S.mode = 'ssp';* >> *S.prefix = 'T';* >> *D = spm_eeg_correct_sensor_data(S);* >> >> which works on an older machine running Matlab2011b and SPM12 v. 6470 but >> on a newer machine running Matlab2017b and SPM12 v. 7487 it gives the >> following error >> >> >> SPM12: spm_eeg_artefact (v7132) 11:39:49 - 25/11/2018 >> ======================================================================== >> >> SPM12: spm_eeg_artefact_eyeblink (v7132) 11:39:58 - 25/11/2018 >> ---------------------------------------------------------------- >> Number of putative eyeblinks detected: 87 >> 4.3677 eye-blinks per minute >> Error using *<= * >> Matrix dimensions must agree. >> >> Error in meeg/badsamples (line 40) >> (trialonset(this, >> trialind(i))+time(this))<=(ev(k).time+ev(k).duration)); >> >> Error in spm_eeg_artefact (line 152) >> bad = squeeze(mean(mean(badsamples(D, meegind, ':', ':'), 2), 3)) > >> S.badchanthresh; >> >> Error in xStep1_DataPreProc_20180806 (line 79) >> >> Any ideas what's causing this error, and how can I fix this? >> >> Thanks, >> -Muhammad >> >> >> >>