Hi SPMers,

I am doing eyeblink correction on an EEG dataset that was imported from EEGLAB using the following script


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 = 1;
S.timewin = [-Inf Inf];
D = spm_eeg_spatial_confounds(S);


S = [];
S.D = [Reapp_dir,'\',preblinkfile];
S.mode = 'spmeeg';
S.conffile = [Reapp_dir,'\',blinkfile];
D = spm_eeg_spatial_confounds(S);


S = [];
S.D = D;
S.mode = 'ssp';
S.prefix = 'T';
D = spm_eeg_correct_sensor_data(S);


However, I get the following error

Error using scalingfactor (line 168)
cannot convert V to unknown

Error in scalingfactor (line 87)
  factor = cellfun(@scalingfactor, old(:), new(:));

Error in ft_apply_montage (line 294)
  scale = scalingfactor(input.chanunit, montage.chanunitorg);

Error in spm_eeg_montage (line 361)
                    sens = ft_apply_montage(sens, sensmontage, 'keepunused', keepunused);

Error in spm_eeg_correct_sensor_data (line 144)
    Dnew = spm_eeg_montage(S1);

Error in NARC_PostEeglabConv_Reapp_Proc (line 350)
D = spm_eeg_correct_sensor_data(S);


I am not sure why the 'newunit' variable from scalingfactor.m gets the value 'unknown'.

Any help with this will be very much appreciated.

Thanks,
-Muhammad