<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Dear Martin,
<div class=""><br class="">
</div>
<div class="">Thanks for your message. Sorry to hear that you experience some issues. ft_dipolefitting has received a facelift recently, so it could be that the issue you report is a genuine problem. On the other hand, it could also be that something unexpected
 happens due to an unexpected feature in your data, which causes an error in the changed code. Our battery of test functions apparently ran through just fine, causing the changed function to percolate into the relase version of the codebase. Yet, our tests
 are not exhaustive, and it could be that there are user scenarios that we haven’t thought of.</div>
<div class=""><br class="">
</div>
<div class="">In order to be able to make the distinction between a genuine bug, and an interaction between features-of-the-specific-usecase and the updated code, could you investigate a bit more what’s going on, using the matlab debugger? If you put a breakpoint
 in the code on line 442 (or so), or type ‘dbstop if error’ on the matlab command line, and then execute ft_dipolefitting again, you should be able to investigate the content of the variables. Specifically, it would be interesting to know what the content is
 of the ‘sourcemodel' variable, as well as whether the variable ‘indx’ is properly created on line 442.</div>
<div class=""><br class="">
</div>
<div class="">Alternatively, you could send us some data (essentially the timelockds{4} + leadfield_eeg + headmodel_eeg which would allow us to reproduce the issue and, if needed, make a fix.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 1 Jul 2020, at 13:35, Martin Schaefer <<a href="mailto:martin.schaefer@ki.se" class="">martin.schaefer@ki.se</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
Dear all,</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
I ran into the following error message when calling the ft_dipolefitting function on my data:</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<blockquote style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none; border-left-width: 3px; border-left-style: solid; border-color: rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);" class="">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span class="">Error using reshape<br class="">
</span>
<div class="">Number of elements must not change. Use [] as one of the size inputs to automatically calculate the appropriate size for that dimension.<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Error in ft_dipolefitting (line 444)<br class="">
</div>
<div class="">      dip.pos = reshape(dip.pos,3,cfg.numdipoles)';     % convert to a Nx3 array<br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Error in dipole_fitting (line 152)<br class="">
</div>
<span class="">dipole_eeg_late = ft_dipolefitting(cfg, timelockeds{4});</span><br class="">
</div>
</blockquote>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
My cfg commands:</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<blockquote style="border-left-width: 3px; border-left-style: solid; border-color: rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-size: 10pt;" class="">cfg = [];</span><span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class=""><br class="">
</span>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.gridsearch         = 'yes';            </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.numdipoles      = 1;                </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.symmetry         = [];              </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.grid                    = leadfield_eeg;    </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.headmodel      = headmodel_eeg;    </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.dipfit.metric    = 'rv';             </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.model               = 'regional';       </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.senstype          = 'eeg';           </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.channel           = 'all';            </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.nonlinear        = 'yes';            </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.latency             = early_latency;    </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<span style="font-size: 10pt;" class="">cfg.backproject     = 'yes';            </span><br class="">
</div>
<div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">
<br class="">
</div>
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255); font-size: 10pt;" class="">dipole_eeg_early = ft_dipolefitting(cfg, timelockeds{4});</span><br class="">
</blockquote>
</div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class=""><br class="">
</span></div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class=""><br class="">
</span></div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">However, the code runs fine on an older version of fieldtrip (the one used during the last online fieldtrip workshop, I think it is
 from 16-04-2020).</span></div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class=""><br class="">
</span></div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">So I'm not sure whether there is a bug in one of the versions or something else is wrong.</span></div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">Does anyone else have issues with this?</span></div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class=""><br class="">
</span></div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">Best regards,</span></div>
<div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<span style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);" class="">Martin</span></div>
<div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<br class="">
</div>
<div id="Signature" class="">
<div class="">
<div class=""></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">
<div style="margin-top: 0px; margin-bottom: 0px; color: rgb(32, 31, 30); font-family: Tahoma; font-size: 13px; text-align: start; background-color: rgb(255, 255, 255);" class="">
<font color="#333333" size="1" class=""><span lang="en-US" style="margin: 0px;" class=""><span style="color: rgb(118, 113, 113); font-family: Calibri, sans-serif; font-size: 12px; text-align: left; background-color: rgb(255, 255, 255); display: inline !important;" class="">------------</span><br class="">
</span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px; color: rgb(32, 31, 30); font-family: Tahoma; font-size: 13px; text-align: start; background-color: rgb(255, 255, 255);" class="">
<font color="#333333" size="1" class=""><span lang="en-US" style="margin: 0px;" class=""><b class="">Martin Schaefer | </b></span></font><span style="font-family: Tahoma; font-size: x-small;" class="">PhD Student</span></div>
<div style="margin-top: 0px; margin-bottom: 0px; color: rgb(32, 31, 30); font-family: Tahoma; font-size: 13px; text-align: start; background-color: rgb(255, 255, 255);" class="">
<font color="#333333" size="1" class=""><span style="font-family: Tahoma; font-size: x-small; background-color: rgb(255, 255, 255); display: inline !important;" class=""><a href="https://www.perceptionlab.se/" class="">https://www.perceptionlab.se/</a><br class="">
</span></font></div>
<div style="margin-top: 0px; margin-bottom: 0px; color: rgb(32, 31, 30); font-family: Tahoma; font-size: 13px; text-align: start; background-color: rgb(255, 255, 255);" class="">
<font color="#333333" size="1" class="">Department of Clinical Neuroscience (CNS), K8</font></div>
<div style="margin-top: 0px; margin-bottom: 0px; color: rgb(32, 31, 30); font-family: Tahoma; font-size: 13px; text-align: start; background-color: rgb(255, 255, 255);" class="">
<font color="#333333" size="1" class="">Karolinska Institutet | 17 177 Stockholm | Nobels väg 9</font></div>
<div style="margin-top: 0px; margin-bottom: 0px; color: rgb(32, 31, 30); font-family: Tahoma; font-size: 13px; text-align: start; background-color: rgb(255, 255, 255);" class="">
<span lang="en-US" style="margin: 0px;" class=""><font color="gray" size="1" class=""><a href="mailto:artin.arshamian@ki.se" target="_blank" rel="noopener noreferrer" style="margin: 0px;" class="">martin.schaefer@ki.se</a></font></span></div>
<div style="margin-top: 0px; margin-bottom: 0px; color: rgb(32, 31, 30); font-family: Tahoma; font-size: 13px; text-align: start; background-color: rgb(255, 255, 255);" class="">
<span lang="en-US" style="margin: 0px;" class=""><font color="gray" size="1" class="">______________________________________<br class="">
Karolinska Institutet – a Medical University</font></span></div>
<br class="">
</div>
</div>
</div>
</div>
<div style="margin: 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: Times; -webkit-text-stroke-width: 0px; -webkit-text-stroke-color: rgb(0, 0, 0); min-height: 14px; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class="">
<span class="s1" style="-webkit-font-kerning: none;"></span><br class="">
</div>
<div style="margin: 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: Times; -webkit-text-stroke-width: 0px; -webkit-text-stroke-color: rgb(0, 0, 0); min-height: 14px; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class="">
<span class="s1" style="-webkit-font-kerning: none;"></span><br class="">
</div>
<div style="margin: 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: Times; -webkit-text-stroke-width: 0px; -webkit-text-stroke-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class="">
<span class="s1" style="-webkit-font-kerning: none;"><i class="">När du skickar e-post till Karolinska Institutet (KI) innebär detta att KI kommer att behandla dina personuppgifter.<span class="Apple-converted-space"> </span></i><a href="https://ki.se/medarbetare/integritetsskyddspolicy" class=""><span class="s2" style="text-decoration: underline; -webkit-font-kerning: none; color: rgb(0, 0, 238); -webkit-text-stroke-width: 0px; -webkit-text-stroke-color: rgb(0, 0, 238);">Här
 finns information om hur KI behandlar personuppgifter</span></a>.<span class="Apple-converted-space"> </span></span></div>
<div style="margin: 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: Times; -webkit-text-stroke-width: 0px; -webkit-text-stroke-color: rgb(0, 0, 0); min-height: 14px; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class="">
<span class="s1" style="-webkit-font-kerning: none;"></span><br class="">
</div>
<div style="margin: 0px; font-style: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 12px; line-height: normal; font-family: Times; -webkit-text-stroke-width: 0px; -webkit-text-stroke-color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;" class="">
<span class="s1" style="-webkit-font-kerning: none;"><i class="">Sending email to Karolinska Institutet (KI) will result in KI processing your personal data.</i><span class="Apple-converted-space"> </span><a href="https://ki.se/en/staff/data-protection-policy" class=""><span class="s2" style="text-decoration: underline; -webkit-font-kerning: none; color: rgb(0, 0, 238); -webkit-text-stroke-width: 0px; -webkit-text-stroke-color: rgb(0, 0, 238);">You
 can read more about KI’s processing of personal data here</span></a>.<span class="Apple-converted-space"> </span></span></div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>