[FieldTrip] ft_connectivity_laggedcoherence error

steph bick35 at gmail.com
Sat Oct 31 01:31:55 CET 2015


Hello fieldtrip experts,

I tried ft_connectivity_laggedcoherence and ran in this error: 

Error in ft_connectivity_laggedcoherence (line 228)
                    laggedcrossproduct = fcs1(chancmbind(:,1),tcounter).*conj(fcs2(chancmbind(:,2),tcounter));

This is the code starting at line 224:

               fcs1(:,colswithnans) = []; fcs2(:,colswithnans) = [];
                % sum laggedcrossproducts and power over all timepoints
                for tcounter=1:length(t1)
                    laggedcrossproduct = fcs1(chancmbind(:,1),tcounter).*conj(fcs2(chancmbind(:,2),tcounter));
                    laggedcps(:,lagindx,trialindx)     = laggedcps(:,lagindx,trialindx)+ laggedcrossproduct;
                    power(:,lagindx,1,trialindx)       = power(:,lagindx,1,trialindx)+ abs(fcs1(chancmbind(:,1),tcounter)).^2;
                    power(:,lagindx,2,trialindx)       = power(:,lagindx,2,trialindx)+ abs(fcs2(chancmbind(:,2),tcounter)).^2;
                    hasdata(trialindx,lagindx)         = true;
                    nsmplslaggedcps(lagindx,trialindx) = nsmplslaggedcps(lagindx,trialindx)+1;
                end;


I thing my error appeared because I had some columns with NAN’s which were removed (fcs1(:,colswithnans) = []; fcs2(:,colswithnans) = []; ). Then the second dimension of the matrix fcs1 did not match length(t1). 

The code runs without error when replacing:

%                 for tcounter=1:length(t1)
                for tcounter=1:size(fcs1,2)

Would the output still be correct?

Thank you!

Stephan




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151030/851db43d/attachment-0001.html>


More information about the fieldtrip mailing list