# [FieldTrip] Connectitivy Analysis - partial directed coherence

Jörn M. Horschig jorn at artinis.com
Mon Feb 23 12:06:25 CET 2015

```HI Barbara,

I hope I followed all of your mail. I think this should work:

>> mean(mean(mean(connectivity.pdcspctrm(frontal(:), parietal(:), 5:16), 1),
2),  3)
This first averages over the frontal channels, then over the parietal
channels, then over frequencies.

You get into troubles with your nana solution though, so you might need to
use something like frontal(~isnan(frontal(:, 1)),  :) = []; to get rid of
these.

Best,
Jörn

--

Jörn M. Horschig, Software Engineer
Artinis Medical Systems  |  +31 481 350 980

> -----Original Message-----
> From: fieldtrip-bounces at science.ru.nl [mailto:fieldtrip-
> bounces at science.ru.nl] On Behalf Of Barbara Schorr
> Sent: Monday, February 23, 2015 11:50 AM
> To: fieldtrip at science.ru.nl
> Subject: [FieldTrip] Connectitivy Analysis - partial directed coherence
>
> Dear Fieldtrippers
>
>
>
> Here the introduction to my problem (I hope I can make myself clear):
>
> I am doing a connectivity analysis (partial directed coherence) and obtain
as a
> result following array:
>
>
>
> connectivity =
>
> label:{51x1}
> dimord: 'chan_chan_freq'
> pdcspctrm: [51x51x101]
> freq: [1x101 double]
> cfg: [1x1 struct]
>
>
>
>
> I have 51 channels in my analysis. I want to find out the outflow from
frontal
> to parietal regions.
> So what I did next was defining which channels belong to frontal and which
> to parietal regions (note: the sensor layout of the sensor net is really
> random), e.g.:
>
>
>
> Frontal = { 'E5' 'E6' 'E197' 'E198'}
> Parietal = { 'E77' 'E78' 'E89' 'E163'}
>
>
>
>
> Next step: find outflow from each Frontal to each Parietal channels
>
>
> In order to do this I need to look in "connectivity.pdspctrm" for the pdc
> value:
>
> find all the channels in "Frontal" and "Parietal" in the original
"connectivity" in
> order to find there the corresponding pdc values:
>
>
> "frontal" is a vector with indices of the channels in the
connectivity.label
> channel list (same with "parietal")
>
> frontal = zeros(4,1)
>
> for l=1:4
>     channelposition = find(ismember(connectivity.label, Frontal{l}) == 1);
>     if isfinite(channelposition);
>
>         if isfinite (ismember(connectivity.label, Frontal{l}) == 1,
frontal (l,1) =
> find(ismember(connectivity.label, Frontal{l}) ==1); else frontal(l,1) =
NaN;
> end
>
>     else
>     end
> end
>
>
>
> I get: frontal =
>
> 1
> 2
> 10
> 11
>
> parietal = zeros(4,1)
>
> for l=1:4
>     channelposition = find(ismember(connectivity.label, Parietal {l}) ==
1);
>     if isfinite(channelposition);
>
>         if isfinite (ismember(connectivity.label, Parietal{l}) == 1,
parietal  (l,1) =
> find(ismember(connectivity.label, Parietal{l}) ==1); else parietal(l,1) =
NaN;
> end
>
>     else
>     end
> end
>
>
>
> I get: parietal =
>
> 9
> 14
> 20
> 31
>
>
> If I want to know now the outflow from E5 to E77 i would have to enter
this
> as follows:
>
> Outflow = connectivity.pdcsptrm(1,9,5)  %5 is here just an example for the
> frequency of interest
>
> and I would get a value, e.g.
>
> ans = 0.567
>
> (This worked totally fine!)
>
>
>
>
>  >>>>>>>>>>>>>Now my Problem: <<<<<<<<<<<<<<
>
> I don't want to know the outflow from a single electrode to another, but
the
> average outflow from frontal to parietal for the whole Alpha
frequencyband:
>
> So my line of code would look like this:
>
>
> Outflow = connectivity.pdcspctrm(frontal',parietal',5:16)
>
>
>
> I tried eval (eventhough it is not elegant, but it's the only thing I
could think
>
>
>
> Outflow = eval ([ 'mean(mean(mean(connectivity.pdcspctrm('
> num2str(frontal') ',' num2str(parietal'), 5:16))))' ])
>
>
> When I enter it as follows:
>
> Outflow = mean(mean(mean(connectivity.pdcspctrm([1 2 10 11], [9 14 20
> 31], 5:16))))
>
> it works fine.
>
>
>
> But the vectors frontal and parietal will contain upt to 30 indices each,
so
> typing them is not an option.
>
> I tried everything else I could think of (different parethesis etc.).
>
> Maybe someone can help me out here??
>
> Thanks a lot!!
>
>
>
>
>
>
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

```