bbci / bbci_public

MATLAB toolbox for Brain-Computer Interfacing (BCI)
MIT License
148 stars 104 forks source link

problems in proc_csp if whitening matrix does not have full rank #195

Closed stephaniebrandl closed 7 years ago

stephaniebrandl commented 8 years ago

When using proc_csp with the following parameters:

'CovFcn',@cov,
'ScoreFcn',@score_medianvar

the whitening matrix M (proc_csp, l.74) might not have full rank anymore. This results in an error in score_medianvar when doing the for loop over all channels, since not all channels are accessible anymore (because of proc_linearDerivation(dat,W)). I added some code into score_medianvar to adapt the number of channels in case W is not quadratic.

if size(W,2)<nChans
    nChans=size(W,2);
end