[Eeglablist] What to do with more than one IC per subject in a cluster

Arnaud Delorme arno at ucsd.edu
Tue Mar 19 10:55:55 PDT 2013


Yes, this sounds like a good solution.
When using STUDY, if you want to plot ERP for a given cluster, you may simply add the ERP of all components from the same subjects. The code below will do that and merge components if there are several per subject.

clust   = 10;
STUDY = std_erpplot(STUDY,ALLEEG,'clusters',clust);
 
erpData  = STUDY.cluster(clust).erpdata;
erpTimes = STUDY.cluster(clust).erptimes;
setInds  = STUDY.cluster(clust).setinds;
 
% scan design
for iCell = 1:length(setInds(:))
    % scan subjects
    uniqueSubj = unique(setInds{iCell});
    for iSubj = 1:length(uniqueSubj)
        subjInd    = setInds{iCell} == uniqueSubj(iSubj);
        erpData2{iCell}(:,iSubj) = sum( erpData{iCell}(:,subjInd), 2);
    end;
end;
 
std_plotcurve(erpTimes, erpData2);

Best,

Arno

On 15 Mar 2013, at 01:24, Tarik S Bel-Bahar wrote:

> Hello,
> Here below is an example of some code that used to work when I had to
> merge ICs in the past,
> So I am not sure if it still works.
> A standardized solution would be useful.
> If possible, any followup thoughts from Makoto or Arno would be nice.
> For the time being, I hope it's a step in the right direction.
> 
> 
> IC1=1;IC2=3;
> % normalize scalp maps (columns of W^-1) to have same sign
>    sgn = sign(corr(EEG.icawinv(:,IC1),EEG.icawinv(:,IC2)));
> 
> % average the scalp maps
> 
> EEG.icawinv(:,IC1) = (EEG.icawinv(:,IC1) + sgn*EEG.icawinv(:,IC2))/2;
> EEG.icawinv(:,IC2) = [];
> 
> % recompute weights and sphering matrix % note that we assume
> icaweights= W*Q where Q is the "true" sphering % matrix (who's
> information is already contained in icawinv = W^-1=A)
> 
> EEG.icaweights = pinv(EEG.icawinv); EEG.icasphere = eye(EEG.nbchan);
> 
> % recompute ICA activations (S = W*X)
> 
> EEG.icaact = EEG.icaweights*EEG.data(:,:); EEG.icaact =
> reshape(EEG.icaact,size(EEG.icaact,1),EEG.pnts,EEG.trials);
> [ALLEEG, EEG, CURRENTSET] = eeg_store( ALLEEG, EEG, 2 ); eeglab redraw
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20130319/754e7aa3/attachment.html>


More information about the eeglablist mailing list