<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="">
Hi Kamil,
<div class=""><br class="">
</div>
<div class="">I suggest that you put a breakpoint in the code, on line 89 of the function ft_nirs_optodedistance, and check what is going on. This is a generic strategy that I always use when any matlab code throws an error. This namely allows you to inspect
 the function’s workspace at the point at which the faulty line will be executed. </div>
<div class=""><br class="">
</div>
<div class="">The reported error message is a low-level matlab error, which suggests that the number of elements in the vector ‘posidx’ (i.e. the left side of the =-sign) is different from the number of elements of the idxR and idXT vectors (i.e. on the right
 side of the =-sign). Given the fact that the code that is executing in line 89, is within a for-loop, and the fact that posIdx is the actual loop-variable, this is just a single value, which - from a distance (pun intended) - probably means that the idxR/idxT
 are either empty, or contain more than a single element. </div>
<div class=""><br class="">
</div>
<div class="">Given that those quantities are derived from the ‘label’, and ‘olabel’ variables, which are defined on lines 67 and 68, this suggests that the code cannot handle well the way in which the datain.label, and the datain.opto.optolabel relate to one
 another. Once you have acertained that this is indeed the cause of your problem, you need to think about whether the discrepancy arises from your data (i.e. the naming convention of the labels is not how it should be), or whether the heuristic that is used
 in the code should be improved. If it is the latter, I suggest that you get in touch with the artinis folks (who contributed this part of the fieldtrip code) in order to look into this.</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 5 Jan 2024, at 10:48, Kamil Hiralal via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1; 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;">
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Dear community,<span class="Apple-converted-space"> </span><o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
My name is Kamil Hiralal and I am a PhD student at the Erasmus Medical Center in Rotterdam.<o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I am currently trying to analyze previously collected fNIRS data from a study investigating phenotypical overlap between children with autism spectrum disorder and Fragile X syndrome.<o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
We have measured fNIRS signal using an Artinis device with a custom channel template with 8 channels of interest placed over the left and right frontal hemispheres. For both the left and right hemisphere, we have also used a short channel as reference.<span class="Apple-converted-space"> </span><o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I am currently trying to re-reference our normal distance channels based on the short channels, but I am having some trouble and was hoping somebody could help me out.<o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
When I am trying to run the ft_nirs_referencechannelsubtraction() function, I get the following error:<o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<p class="x614019680msonormal" style="margin-right: 0cm; margin-left: 0cm; font-size: 12pt; font-family: "Times New Roman", serif;">
<i class=""><span style="font-size: 10pt; font-family: Arial, sans-serif;" class="">Unable to perform assignment because the left and right sides have a different number of elements.</span></i><span style="font-size: 10pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></p>
<p class="x614019680msonormal" style="margin-right: 0cm; margin-left: 0cm; font-size: 12pt; font-family: "Times New Roman", serif;">
<i class=""><span style="font-size: 10pt; font-family: Arial, sans-serif;" class=""> Error in ft_nirs_optodedistance (line 89)</span></i><span style="font-size: 10pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></p>
<p class="x614019680msonormal" style="margin-right: 0cm; margin-left: 0cm; font-size: 12pt; font-family: "Times New Roman", serif;">
<i class=""><span style="font-size: 10pt; font-family: Arial, sans-serif;" class="">  optodedistance(posIdx)              = sqrt( (xf(idxR)-xf(idxT)).^2+(yf(idxR)-yf(idxT)).^2 ); % Pythagorean theorem</span></i><span style="font-size: 10pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></p>
<p class="x614019680msonormal" style="margin-right: 0cm; margin-left: 0cm; font-size: 12pt; font-family: "Times New Roman", serif;">
<i class=""><span style="font-size: 10pt; font-family: Arial, sans-serif;" class="">Error in ft_nirs_referencechannelsubtraction (line 123)</span></i><span style="font-size: 10pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></p>
<p class="x614019680msonormal" style="margin-right: 0cm; margin-left: 0cm; font-size: 12pt; font-family: "Times New Roman", serif;">
<i class=""><span style="font-size: 10pt; font-family: Arial, sans-serif;" class="">distances   = ft_nirs_optodedistance(datain);</span></i><span style="font-size: 10pt; font-family: Arial, sans-serif;" class=""><o:p class=""></o:p></span></p>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I am using the default cfg set-up (shortdistance = 1.5, closedistance = 15, method = ‘QR’, verbose = FALSE). I am also using raw NIRS data, as outputted by FT_PREPROCESSING. I hope anyone might be able to help me with this question!<o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Best,<span class="Apple-converted-space"> </span><o:p class=""></o:p></div>
<div style="margin: 0cm 0cm 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Kamil Hiralal<o:p class=""></o:p></div>
</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://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C94d853bc26774257ecee08dc10817524%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638403395394354926%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ngMKvlqmKlUevw11A7Pdzj7%2FShFZe6nIYf6qAQWZr%2FI%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" shash="p95uDbN5a1P9DUGWns01xfDwFsYj7Wjqjp+SeWyRxlpVSUUgHhq9ALE29GF62BZkcgerKB3XpamcmbAdeodIJ8ySvkzXC1NRJ+ey4V6HkMi2pKfoL29ZJmMuVKzkwuP28c1fKZ8MyfQWOgmYGqDBJHqegciX9N7PiDfedkJT+RM=" style="color: rgb(149, 79, 114); text-decoration: underline; 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://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C94d853bc26774257ecee08dc10817524%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638403395394354926%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=NJb783GuFpEIHD%2BS7y%2FO2FsWJ3vMSmmmbhLT1uMVLuQ%3D&reserved=0" originalsrc="https://doi.org/10.1371/journal.pcbi.1002202" shash="t/FXyPgibtuy/lz9kg0qA2fONgW6wW+tmPOUWaaAS78pAUBmmJRAUuIHRfhzNsGbrC44o0ffmQ7+biTLoDolW9K447XdVC9C6i4GP+YOeEkKxm8PsWklhv+se7+ImWFkH0oeSqummWf+VSvIqzun7jrGJa6wpWBAGKHE4MuS+TU=" style="color: rgb(149, 79, 114); text-decoration: underline; 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>