reject components with less components than channels in matrix
Nicolas Robitaille
enteka at HOTMAIL.COM
Fri Aug 15 17:22:24 CEST 2008
Hi Thomas
I ran into the same kind of problem running PCA reduction in binica. I end up with an unstable workaround, so I won't send it, but you may like to know that:
1- in rejectcomponent.m, the number of component is determine by the length of the comp.label list, which is created in componentanalysis.m.
[line 75 of rejectcomponent.m]
% determine the number of channels and the number of components
Nchan = length(comp.topolabel);
Ncomp = length(comp.label);
I needed to fix the creation of this list, I guess you may have to.
2- In order to actually do the rejection, I created an empty square matrix (full of 0) and stick in it the components to-be-kept.:
[line 99 of rejectcomponent.m]
comp.topo(:,cfg.component) = 0;
w = zeros(Nchan,Nchan);
w(:,1:Ncomp) = comp.topo;
for ii=1:ntrials
data.trial(ii,:,:) = w * squeeze(data.trial(ii,:,:));
end
Hope this help
Nic
************************************
Nicolas Robitaille, candidat Ph.D
Département de Psychologie
Université de Montréal
C.P. 6128, succursale Centre-ville
Montréal, Québec H3C 3J7
Tel.: 514-343-6111 x2631
Fax: 514-343-5787
************************************
> Date: Fri, 15 Aug 2008 16:42:32 +0200
> From: thomas.hartmann at UNI-KONSTANZ.DE
> Subject: [FIELDTRIP] reject components with less components than channels in matrix
> To: FIELDTRIP at NIC.SURFNET.NL
>
> hi y'all!
>
> i am trying to use the ica to correct my data for artifacts. as i do an
> average-reference on the data prior to calculating the weights using
> fastica, only 63 components are computed from my 64 channels.
>
> if i then try to run componentanalysis on the real data using the former
> calculated weights, componentanalysis gives an error because the
> function expects as many components as channels in the input.
>
> i fixed this in the file. but rejectcomponent also seems to expect as
> many components as channels, as it tells me that it e.g. removed 2
> components and kept 62, although there are only 63 components in the matrix.
>
> any help?
>
> cheers and thanks,
> thomas
>
> ----------------------------------
> The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.
_________________________________________________________________
----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20080815/6d0850f3/attachment-0002.html>
More information about the fieldtrip
mailing list