<div dir="ltr"><div><div><div>Hi Jörn, <br></div>I downloaded version 20130502 and ran both my code and the test code that you had emailed. I get 1 and inf with both. <br></div>The freq input seems to be ok, so ist must be an issue with ft_connectivityanalysis. <br>

</div>Lucia<br></div><div class="gmail_extra"><br clear="all"><div><font color="#666666">-- <br>Lucia.</font></div>
<br><br><div class="gmail_quote">On Fri, May 3, 2013 at 2:32 AM, "Jörn M. Horschig" <span dir="ltr"><<a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>Dear Lucia,<br>
      <br>
      could you try whether the error persists with a recent version? If
      it does, could you go test whether this code gives the same error:<br>
      <br>
      <i><small><br>
          % ************* code starts here </small></i><br>
      <i><small>%dummy data<br>
          cfg             = [];<br>
          cfg.ntrials     = 500;<br>
          cfg.triallength = 1;<br>
          cfg.fsample     = 200;<br>
          cfg.nsignal     = 3;<br>
          cfg.method      = 'ar';<br>
          cfg.params(:,:,1) = [ 0.8 0   0; <br>
                                0   0.9 0.5;<br>
                                0.4 0   0.5];<br>
          cfg.params(:,:,2) = [-0.5    0  0; <br>
                                  0 -0.8  0; <br>
                                  0    0 -0.2];<br>
          cfg.noisecov      = [0.3 0 0;<br>
                                 0 1 0;<br>
                                 0 0 0.2];<br>
          <br>
          data            = ft_connectivitysimulation(cfg);<br>
          <br>
          <br>
          % freqanalysis<br>
          cfgf           = [];<br>
          cfgf.method    = 'mtmfft';<br>
          cfgf.output    = 'fourier';<br>
          cfgf.tapsmofrq = 2;<br>
          freq           = ft_freqanalysis(cfgf, data);<br>
          <br>
          % connectivityanalysis<br>
          cfgc           = [];<br>
          cfgc.method    = 'coh';<br>
          c1             = ft_connectivityanalysis(cfgc, freq);<br>
          <br>
          c1.cohspctrm</small></i><i><small><br>
          % ************* code ends here <br>
        </small></i><br>
      The code snippet above is part of our test suite for making sure
      that everything works fine. If it does work for you, but does not
      with your own data instead of simulated data, the error must be
      somewhere in your data, e.g. powspctrm consists of nans or 0s etc.
      Anyway, I assume that it will all work fine if you use an updated
      version of FieldTrip.<br>
      <br>
      Best,<br>
      Jörn<div><div class="h5"><br>
      <br>
      <br>
      On 5/3/2013 12:56 AM, Lucia Melloni wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div>Hi Jan-Mathijs, <br>
          </div>
          still the same result with the code that you suggested. <br>
          <br>
          selection fourierspctrm along dimension 2<br>
          averaging crsspctrm over rpt<br>
          removing dimension rpt from crsspctrm<br>
          Warning: PROGRESS is only a compatibility wrapper, which will
          soon be removed. Please instead call FT_PROGRESS. <br>
          > In progress at 16<br>
            In ft_connectivity_corr at 87<br>
            In ft_connectivityanalysis at 524<br>
          Warning: PROGRESS is only a compatibility wrapper, which will
          soon be removed. Please instead call FT_PROGRESS. <br>
          > In progress at 16<br>
            In ft_connectivity_corr at 89<br>
            In ft_connectivityanalysis at 524<br>
          Warning: PROGRESS is only a compatibility wrapper, which will
          soon be removed. Please instead call FT_PROGRESS. <br>
          > In progress at 16<br>
            In ft_connectivity_corr at 106<br>
            In ft_connectivityanalysis at 524<br>
          the call to "ft_connectivityanalysis" took 0 seconds<br>
          <br>
          <br>
        </div>
        Lucia</div>
      <div class="gmail_extra"><br clear="all">
        <div><font color="#666666">-- <br>
            Lucia.</font></div>
        <br>
        <br>
        <div class="gmail_quote">On Thu, May 2, 2013 at 3:12 PM,
          jan-mathijs schoffelen <span dir="ltr"><<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div style="word-wrap:break-word">Hi Lucia,
              <div><br>
              </div>
              <div>The warnings indicate that you are dividing by zero.
                Are you sure that your cfg is correct?</div>
              <div><br>
              </div>
              <div>Please try</div>
              <div><br>
              </div>
              <div>cfg = [];</div>
              <div>cfg.method = 'coh';</div>
              <div>coh = ft_connectivityanalysis(cfg, freq);</div>
              <div><br>
              </div>
              <div>This should work.</div>
              <div><br>
              </div>
              <div>
                Best,</div>
              <div>Jan-Mathijs</div>
              <div>
                <div>
                  <div><br>
                    <div>
                      <div>On May 2, 2013, at 6:56 PM, Lucia Melloni
                        wrote:</div>
                      <br>
                      <blockquote type="cite">
                        <div dir="auto">
                          <div>Hi jan-mathijs</div>
                          <div><br>
                          </div>
                          <div>Unfortunately I get the same result
                            whether or not I remove the mean. </div>
                          <div>Best,</div>
                          <div>-- Lucía</div>
                          <div><br>
                            On May 2, 2013, at 9:57 AM, jan-mathijs
                            schoffelen <<a href="mailto:jan.schoffelen@donders.ru.nl" target="_blank">jan.schoffelen@donders.ru.nl</a>>
                            wrote:<br>
                            <br>
                          </div>
                          <blockquote type="cite">
                            <div>Hi Lucia,
                              <div><br>
                              </div>
                              <div>Could you remove cfg.removemean =
                                'yes' and try again?</div>
                              <div><br>
                              </div>
                              <div>Best,</div>
                              <div><br>
                              </div>
                              <div>Jan-Mathijs</div>
                              <div><br>
                                <div>
                                  <div>On Apr 29, 2013, at 2:38 AM,
                                    Lucia Melloni wrote:</div>
                                  <br>
                                  <blockquote type="cite">
                                    <div>Hi!<br>
                                      I am trying to calculate coherence
                                      using ft_connectivityanalysis, but<br>
                                      I am getting only ones and
                                      infinity as output in cohspctrm
                                      with all of<br>
                                      my data sets.<br>
                                      <br>
                                      I first run ft_freqanalysis with<br>
                                      cfg.method = 'mtmfft';<br>
                                      cfg.taper = 'dpss';<br>
                                      cfg.output = 'fourier';<br>
                                      cfg.foilim = [1 45];<br>
                                      cfg.tapsmofrq = 1;<br>
                                      cfg.keeptrials = 'yes';<br>
                                      cfg.keeptapers = 'yes';<br>
                                      freq = ft_freqanalysis(cfg, data);<br>
                                      <br>
                                      Whether I do or I do not specify
                                      cfg.channel and cfg.channelcmb
                                      here<br>
                                      does not seem to make a difference
                                      for my problem later on. The<br>
                                      spectra look absolutely fine.<br>
                                      <br>
                                      I then run ft_connectivityanalysis
                                      with<br>
                                      cfg.method    = 'coh';<br>
                                      cfg.removemean= 'yes';<br>
                                      cfg.trials    = 'all';<br>
                                      cfg.feedback  = 'yes';<br>
                                      cfg.complex   = 'abs';<br>
                                      coh           =
                                      ft_connectivityanalysis(cfg,
                                      freq);<br>
                                      <br>
                                      The cohspctrm looks like this:<br>
                                      val(:,:,1,1) =<br>
                                      <br>
                                          1   Inf   Inf   Inf   Inf
                                        Inf   Inf   Inf   Inf   Inf
                                        Inf<br>
                                      Inf   Inf   Inf (etc.)<br>
                                      <br>
                                      I get the following warning during
                                      ft_connectivityanalysis<br>
                                      <br>
                                      Warning: Divide by zero.<br>
                                      <blockquote type="cite">In
                                        ft_connectivity_corr at 103<br>
                                      </blockquote>
                                       In ft_connectivityanalysis at 524<br>
                                      Warning: Divide by zero.<br>
                                      <blockquote type="cite">In
                                        ft_connectivity_corr at 104<br>
                                      </blockquote>
                                       In ft_connectivityanalysis at 524<br>
                                      <br>
                                      The same happens if I try to
                                      calculate PLV through
                                      ft_connectivityanalysis.<br>
                                      This is with Fieldtrip version
                                      20130422 and 20130427, Matlab
                                      R2009a,<br>
                                      Windows 7 (64bit).<br>
                                      <br>
                                      Any advice?<br>
                                      Thanks!<br>
                                      Lucia<br>
_______________________________________________<br>
                                      fieldtrip mailing list<br>
                                      <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
                                      <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
                                    </div>
                                  </blockquote>
                                </div>
                                <br>
                                <div>
                                  <span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium"><span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">
                                      <div style="word-wrap:break-word">
                                        <span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">
                                          <div style="word-wrap:break-word">
                                            <span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">
                                              <div style="word-wrap:break-word">
                                                <span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">
                                                  <div style="word-wrap:break-word">
                                                    <span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">
                                                      <div style="word-wrap:break-word">
                                                        <span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">
                                                          <div style="word-wrap:break-word">
                                                          <span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">
                                                          <div style="word-wrap:break-word">
                                                          <span style="border-collapse:separate;font-family:Helvetica;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">
                                                          <div style="word-wrap:break-word">
                                                          <div>Jan-Mathijs
                                                          Schoffelen, MD
                                                          PhD </div>
                                                          <div><br>
                                                          </div>
                                                          <div>Donders
                                                          Institute for
                                                          Brain,
                                                          Cognition and
                                                          Behaviour, <br>
                                                          Centre for
                                                          Cognitive
                                                          Neuroimaging,<br>
                                                          Radboud
                                                          University
                                                          Nijmegen, The
                                                          Netherlands</div>
                                                          <div><br>
                                                          </div>
                                                          <div>Max
                                                          Planck
                                                          Institute for
Psycholinguistics,</div>
                                                          <div>Nijmegen,
                                                          The
                                                          Netherlands</div>
                                                          <div><br>
                                                          </div>
                                                          <div><a href="mailto:J.Schoffelen@donders.ru.nl" target="_blank">J.Schoffelen@donders.ru.nl</a></div>
                                                          <div>Telephone:
                                                          <a href="tel:%2B31-24-3614793" value="+31243614793" target="_blank">+31-24-3614793</a></div>
                                                          <div><br>
                                                          </div>
                                                          <div><a href="http://www.hettaligebrein.nl/" target="_blank">http://www.hettaligebrein.nl</a></div>
                                                          </div>
                                                          </span></div>
                                                          </span></div>
                                                        </span></div>
                                                    </span></div>
                                                </span></div>
                                            </span></div>
                                        </span></div>
                                    </span></span>
                                </div>
                                <br>
                              </div>
                            </div>
                          </blockquote>
                          <blockquote type="cite">
                            <div><span>_______________________________________________</span><br>
                              <span>fieldtrip mailing list</span><br>
                              <span><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a></span><br>
                              <span><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></span></div>
                          </blockquote>
                        </div>
                        _______________________________________________<br>
                        fieldtrip mailing list<br>
                        <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
                        <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>
                    </div>
                    <br>
                    <div>
                      <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                          <div style="word-wrap:break-word">
                            <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                              <div style="word-wrap:break-word">
                                <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                                  <div style="word-wrap:break-word">
                                    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                                      <div style="word-wrap:break-word">
                                        <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                                          <div style="word-wrap:break-word">
                                            <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                                              <div style="word-wrap:break-word">
                                                <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                                                  <div style="word-wrap:break-word">
                                                    <span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px">
                                                      <div style="word-wrap:break-word">
                                                        <div>Jan-Mathijs
                                                          Schoffelen, MD
                                                          PhD </div>
                                                        <div><br>
                                                        </div>
                                                        <div>Donders
                                                          Institute for
                                                          Brain,
                                                          Cognition and
                                                          Behaviour, <br>
                                                          Centre for
                                                          Cognitive
                                                          Neuroimaging,<br>
                                                          Radboud
                                                          University
                                                          Nijmegen, The
                                                          Netherlands</div>
                                                        <div><br>
                                                        </div>
                                                        <div>Max Planck
                                                          Institute for
Psycholinguistics,</div>
                                                        <div>Nijmegen,
                                                          The
                                                          Netherlands</div>
                                                        <div><br>
                                                        </div>
                                                        <div><a href="mailto:J.Schoffelen@donders.ru.nl" target="_blank">J.Schoffelen@donders.ru.nl</a></div>
                                                        <div>Telephone:
                                                          <a href="tel:%2B31-24-3614793" value="+31243614793" target="_blank">+31-24-3614793</a></div>
                                                        <div><br>
                                                        </div>
                                                        <div><a href="http://www.hettaligebrein.nl" target="_blank">http://www.hettaligebrein.nl</a></div>
                                                      </div>
                                                    </span></div>
                                                </span></div>
                                            </span></div>
                                        </span></div>
                                    </span></div>
                                </span></div>
                            </span></div>
                        </span></span>
                    </div>
                    <br>
                  </div>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            fieldtrip mailing list<br>
            <a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br>
            <a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
fieldtrip mailing list
<a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></pre>
    </blockquote>
    <br>
    <br>
    </div></div><pre cols="72">-- 
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour 
Centre for Cognitive Neuroimaging
Radboud University Nijmegen 
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: <a href="mailto:jm.horschig@donders.ru.nl" target="_blank">jm.horschig@donders.ru.nl</a>
Tel:    <a href="tel:%2B31-%280%2924-36-68493" value="+31243668493" target="_blank">+31-(0)24-36-68493</a>
Web: <a href="http://www.ru.nl/donders" target="_blank">http://www.ru.nl/donders</a>

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands</pre>
  </div>

<br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>