<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
Hi David,
<div><br>
</div>
<div>Yes, I think that could cause the problem, although if that were true, your specific issue seems to be a convoluted manifestation of it.</div>
<div><br>
</div>
<div>Bottom line with respect to channel order: when using pre-computed leadfields, the underlying assumption is more or less that the order of the channels, as represented in the leadfields, is the same as the order of the channels in the data. In principle,
 this can be accommodated with proper data bookkeeping, i.e. checking the labels that are associated with the data structure containing the forward model (i.e. the leadfield) against the channels in the data. We have started to move in this direction by inclusion
 of a label-field in data structures containing leadfields. Yet, the explicit check  about channels and orderings of channels so far only throws an error if there’s a mismatch in the number of channels.</div>
<div><br>
</div>
<div>Your reported error with a reshape issue could also reflect a problem with the data handling as such. Some more information would be appreciated in this regard. What does your freqAll contain in terms of spectral data? Fourier coefficients or cross-spectra?
 In case it’s cross-spectra, does it include multiple trials or not? If not, would it make sense to switch off the cfg.keeptrials flag in your cfg to ft_sourceanalysis.</div>
<div><br>
</div>
<div>Best,</div>
<div>Jan-Mathijs</div>
<div><br>
</div>
<div><br>
</div>
<div> </div>
<div>
<div>
<div>On Feb 10, 2016, at 3:54 PM, David Pedrosa <<a href="mailto:david.pedrosa@ndcn.ox.ac.uk">david.pedrosa@ndcn.ox.ac.uk</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div ocsi="0" fpstyle="1" style="font-family: Calibri; font-size: 15px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">
<div style="direction: ltr; font-family: Tahoma; font-size: 10pt;">Hi Azeez,<span class="Apple-converted-space"> </span><br>
<br>
I have been checking leadfields and data labels and they are actually the same. But the order is slightly different. Do you think this may cause the problems?<br>
<br>
Thanks for your help.<br>
<br>
Best,<br>
David<br>
<div><br>
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-size: 13px;">
<hr>
<font face="Tahoma" size="2"><font color="003366">Dr. David Pedrosa<br>
</font></font><font face="Tahoma" color="003366" size="2"><br>
Clinical Research Fellow</font><font face="Tahoma" color="003366" size="2"><br>
</font><font face="Tahoma" color="003366" size="2"><span dir="ltr" style="font-size: 10pt;">
<div>
<div><span style="font-size: 13px;">
<div><font size="2"><span style="font-size: 10pt;">Medical Research Council Brain Network Dynamics Unit at the University of Oxford<br>
Nuffield Department of Clinical Neurosciences</span></font></div>
<div>University of Oxford</div>
<div>Level 6, West Wing</div>
<div>John Radcliffe Hospital, OX3 9DU<br>
</div>
</span></div>
</div>
</span></font><font face="Tahoma" color="003366" size="2"><span style="font-size: 10pt;"><u>Tel:</u><span class="Apple-converted-space"> </span></span></font><font face="Tahoma" size="2"><span style="font-size: 10pt;"><font color="003366">+44 (0)1865 572490<br>
<u>E-Mail:</u><span class="Apple-converted-space"> </span></font><font color="333333"><a href="mailto:david.pedrosa@ndcn.ox.ac.uk">david.pedrosa@ndcn.ox.ac.uk</a><br>
</font></span></font><font size="2"><span style="font-size: 10pt;"><br>
<a href="https://owa.nexus.ox.ac.uk/owa/redir.aspx?C=E40BwPuNq0uXQGSOPDW39AmtYlwBR9IIjsI0PRu9uuTE46jeZnqjmG6XP02rBAUiF1EnCJtn3UU.&URL=http%3a%2f%2fwww.mrcbndu.ox.ac.uk%2f" target="_blank">http://www.mrcbndu.ox.ac.uk/</a></span></font><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="font-family: 'Times New Roman'; font-size: 16px;">
<hr tabindex="-1">
<div id="divRpF92585" style="direction: ltr;"><font face="Tahoma" size="2"><b>Von:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a><span class="Apple-converted-space"> </span>[<a href="mailto:fieldtrip-bounces@science.ru.nl">fieldtrip-bounces@science.ru.nl</a>]"
 im Auftrag von "Azeez Adebimpe [<a href="mailto:azeez.adebimpe5@gmail.com">azeez.adebimpe5@gmail.com</a>]<br>
<b>Gesendet:</b><span class="Apple-converted-space"> </span>Freitag, 5. Februar 2016 22:44<br>
<b>An:</b><span class="Apple-converted-space"> </span>FieldTrip discussion list<br>
<b>Betreff:</b><span class="Apple-converted-space"> </span>Re: [FieldTrip] ft_sourceanalysis, reshape error<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Hi David,
<div><br>
</div>
<div>Sorry for late reply, I was on the journey. </div>
<div>The same issue happened to me before when the labels in the leadfield and data were not the same. </div>
<div>if you have 'Fp1' in leadfield and 'FP1' in data, it will view as different channels.</div>
<div><br>
</div>
<div><br>
</div>
<div>Azeez</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Feb 5, 2016 at 9:51 AM, David Pedrosa<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:david.pedrosa@ndcn.ox.ac.uk" target="_blank">david.pedrosa@ndcn.ox.ac.uk</a>></span><span class="Apple-converted-space"> </span>wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">
<div>
<div style="direction: ltr; font-family: Tahoma; font-size: 10pt;">Hi Azeez,<span class="Apple-converted-space"> </span><br>
<br>
thank you for the fast reply!<span class="Apple-converted-space"> </span><br>
I hadn't considered that but I have checked and I use the same labels for both leadfield and data.<br>
<div><br>
I mean it makes kind of sense that the reshape doesn't work as it is now, but I don't know where the problem is before.<br>
<br>
Can you think of anything else?<span class=""><br>
<br>
Best,<br>
David<br>
<br>
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-size: 13px;">
<hr>
<font face="Tahoma" size="2"><font color="003366">Dr. David Pedrosa<br>
</font></font><font face="Tahoma" color="003366" size="2"><br>
Clinical Research Fellow</font><font face="Tahoma" color="003366" size="2"><br>
</font><font face="Tahoma" color="003366" size="2"><span dir="ltr" style="font-size: 10pt;">
<div>
<div><span style="font-size: 13px;">
<div><font size="2"><span style="font-size: 10pt;">Medical Research Council Brain Network Dynamics Unit at the University of Oxford<br>
Nuffield Department of Clinical Neurosciences</span></font></div>
<div>University of Oxford</div>
<div>Level 6, West Wing</div>
<div>John Radcliffe Hospital, OX3 9DU<br>
</div>
</span></div>
</div>
</span></font><font face="Tahoma" color="003366" size="2"><span style="font-size: 10pt;"><u>Tel:</u><span class="Apple-converted-space"> </span></span></font><font face="Tahoma" size="2"><span style="font-size: 10pt;"><font color="003366"><a href="tel:%2B44%20%280%291865%20572490" value="+441865572490" target="_blank">+44
 (0)1865 572490</a><br>
<u>E-Mail:</u><span class="Apple-converted-space"> </span></font><font color="333333"><a href="mailto:david.pedrosa@ndcn.ox.ac.uk" target="_blank">david.pedrosa@ndcn.ox.ac.uk</a><br>
</font></span></font><font size="2"><span style="font-size: 10pt;"><br>
<a href="https://owa.nexus.ox.ac.uk/owa/redir.aspx?C=E40BwPuNq0uXQGSOPDW39AmtYlwBR9IIjsI0PRu9uuTE46jeZnqjmG6XP02rBAUiF1EnCJtn3UU.&URL=http%3a%2f%2fwww.mrcbndu.ox.ac.uk%2f" target="_blank">http://www.mrcbndu.ox.ac.uk/</a></span></font><br>
</div>
</div>
</div>
</div>
</div>
</span></div>
<div style="font-family: 'Times New Roman'; font-size: 16px;">
<hr>
<div style="direction: ltr;"><font face="Tahoma" size="2"><b>Von:</b><span class="Apple-converted-space"> </span><a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a><span class="Apple-converted-space"> </span>[<a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a>]"
 im Auftrag von "Azeez Adebimpe [<a href="mailto:azeez.adebimpe5@gmail.com" target="_blank">azeez.adebimpe5@gmail.com</a>]<br>
<b>Gesendet:</b><span class="Apple-converted-space"> </span>Freitag, 5. Februar 2016 13:56<br>
<b>An:</b><span class="Apple-converted-space"> </span>FieldTrip discussion list<br>
<b>Betreff:</b><span class="Apple-converted-space"> </span>Re: [FieldTrip] ft_sourceanalysis, reshape error<br>
</font><br>
</div>
<div>
<div class="h5">
<div></div>
<div>
<div dir="ltr">Hi David,
<div><br>
</div>
<div>Probably the channels' labels in leadfield and data are not the same.</div>
<div><br>
</div>
<div>check it and try again.</div>
<div><br>
</div>
<div>Azeez</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Feb 5, 2016 at 8:47 AM, David Pedrosa<span class="Apple-converted-space"> </span><span dir="ltr"><<a href="mailto:david.pedrosa@ndcn.ox.ac.uk" target="_blank">david.pedrosa@ndcn.ox.ac.uk</a>></span><span class="Apple-converted-space"> </span>wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">
<div>
<div style="direction: ltr; font-family: Tahoma; font-size: 10pt;">Dear list,<span class="Apple-converted-space"> </span><br>
<br>
after installing the newest version of Fieldtrip today, I have encountered a rather strange error . I am tying to compute corticomuscular coherence for an EEG/EMG dataset and it worked well so far. With the new version however, I get a reshape error I find
 fard to understand. This is the code:<br>
<br>
    cfg              = [];<br>
    cfg.frequency    = 20;;<br>
    cfg.grid        = leadfield;<br>
    cfg.method       = 'dics';<br>
    cfg.refchan      = 'ExtR1';<br>
    cfg.channel         = {'EEG' 'ExtR1'};<br>
    cfg.vol          = hdm;<br>
    cfg.dics.projectnoise = 'no';<br>
    cfg.dics.lambda       = '1%';<br>
    cfg.dics.keepfilter   = 'yes';<br>
    cfg.dics.keeptrials   = 'yes';<br>
    cfg.dics.realfilter   = 'yes';<br>
    sourceAll = ft_sourceanalysis(cfg, freqAll);   <span class="Apple-converted-space"> </span><br>
<br>
but this hasn't changed. The error pops up at lines 619/620 of ft_sourceanalysis (Cf = reshape(sum(Cf, 1) / Ntrials, [Nchans Nchans]);), where it supposedly just averages the CSD matrix over trials.  And it makes kind of sense as the line says to reshape the
 CSDs from a 1xNchans matrix into a [Nchans Nchans] one. But why is it poppin up now as nothing has changed in my analyses? I have checked the updates of the last months and I couldn't find anything related to this. So has any one an idea why the analysis crashes
 at this point.<span class="Apple-converted-space"> </span><br>
<br>
Thanks in advance<br>
Best,<br>
David<br>
<br>
<div>
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-family: Tahoma; font-size: 13px;">
<div style="font-size: 13px;">
<hr>
<font face="Tahoma" size="2"><font color="003366">Dr. David Pedrosa<br>
</font></font><font face="Tahoma" color="003366" size="2"><br>
Clinical Research Fellow</font><font face="Tahoma" color="003366" size="2"><br>
</font><font face="Tahoma" color="003366" size="2"><span dir="ltr" style="font-size: 10pt;">
<div>
<div><span style="font-size: 13px;">
<div><font size="2"><span style="font-size: 10pt;">Medical Research Council Brain Network Dynamics Unit at the University of Oxford<br>
Nuffield Department of Clinical Neurosciences</span></font></div>
<div>University of Oxford</div>
<div>Level 6, West Wing</div>
<div>John Radcliffe Hospital, OX3 9DU<br>
</div>
</span></div>
</div>
</span></font><font face="Tahoma" color="003366" size="2"><span style="font-size: 10pt;"><u>Tel:</u><span class="Apple-converted-space"> </span></span></font><font face="Tahoma" size="2"><span style="font-size: 10pt;"><font color="003366"><a href="tel:%2B44%20%280%291865%20572490" value="+441865572490" target="_blank">+44
 (0)1865 572490</a><br>
<u>E-Mail:</u><span class="Apple-converted-space"> </span></font><font color="333333"><a href="mailto:david.pedrosa@ndcn.ox.ac.uk" target="_blank">david.pedrosa@ndcn.ox.ac.uk</a><br>
</font></span></font><font size="2"><span style="font-size: 10pt;"><br>
<a href="https://owa.nexus.ox.ac.uk/owa/redir.aspx?C=E40BwPuNq0uXQGSOPDW39AmtYlwBR9IIjsI0PRu9uuTE46jeZnqjmG6XP02rBAUiF1EnCJtn3UU.&URL=http%3a%2f%2fwww.mrcbndu.ox.ac.uk%2f" target="_blank">http://www.mrcbndu.ox.ac.uk/</a></span></font><br>
</div>
</div>
</div>
</div>
</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" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</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" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
_______________________________________________<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">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div>
</blockquote>
</div>
<br>
</div>
</body>
</html>