<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear Fieldtrip community, </div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
My name is Erin Mahan and I am a PhD student in the Lundqvist Multimodal Brain Imaging lab at Karolinska Institutet in Stockholm, Sweden. My PhD project will be on imaging the brain of epilepsy patients using MEG and coregistered quantum sensors. Currently,
 I am working through the tutorials of a class on M/EEG to learn Matlab and Fieldtrip (<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnatmegsweden%2Fmeeg_course%2Fblob%2Fmaster%2Ftutorial_03_prepare_mri.md&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cbf798709914641d539fc08de59b52bd3%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C639046831803459775%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=9RVyZpwFH0DBQg0r2fhf9rVTHlNqdduJePmseQTfWnk%3D&reserved=0" originalSrc="https://github.com/natmegsweden/meeg_course/blob/master/tutorial_03_prepare_mri.md" data-outlook-id="a2c0e192-1b21-4ec1-a574-9e99a3669fcf">https://github.com/natmegsweden/meeg_course/blob/master/tutorial_03_prepare_mri.md</a>)</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In the tutorial section integrating the participant’s MRI with EEG, I call ft_prepare_headmodel(cfg, meshes) with the cfg.method “bemcp”.  The meshes “are closed and properly nested” before the error occurs. It throws an error that traces to line 177 in ft_headmodel_bemcp:</div>
<div class="rtcContent" style="direction: ltr; text-align: left; text-indent: 0px; text-transform: none; padding: 30px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; color: rgb(225, 27, 20);">
<span style="line-height: 16.718px;">C11st = bem_Cii_lin(headmodel.bnd(1).tri,headmodel.bnd(1).pos, weight,defl(1),headmodel.bnd(1).pnt4);</span></div>
<div class="rtcContent" style="direction: ltr; text-align: left; text-indent: 0px; text-transform: none; padding: 30px;">
<span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">The error is "</span><span style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; color: rgb(225, 27, 20); line-height: 16.718px;">Undefined
 function 'bem_Cii_lin' for input arguments of type 'double’."</span></div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I have verified the function’s MEX file integrity and presence in the fieldtrip folder, confirmed it’s in the Matlab path, corroborated the cfg and inputs with a colleague, and had the colleague run the script himself with no problems. When attempting to run
 the internal call for bem_Cii_lin, this is the error:</div>
<div class="rtcContent" style="direction: ltr; text-align: left; text-indent: 0px; text-transform: none; padding: 30px;">
<span style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; color: rgb(0, 0, 0); line-height: 16.718px;">bem_Cii_lin(headmodel.bnd(1).tri,headmodel.bnd(1).pos, weight,defl(1),headmodel.bnd(1).pnt4);</span><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</span><span style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; color: rgb(225, 27, 20); line-height: 16.718px;">Unrecognized function or variable 'bem_Cii_lin'.</span></div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Both myself and the colleague have Macs, but his was able to run with no problems. I’m unsure of what to try next. The cfg is below if helpful.</div>
<div style="padding: 30px;">
<div class="S81B99EAF0" style="text-align: left; text-indent: 0px; line-height: 16.718px; text-transform: none; margin: 0px; min-height: 0px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; color: rgb(0, 0, 0);">
cfg =<br>
<br>
<b><a href="matlab:helpPopup('struct')" data-outlook-id="1cfcc66e-5972-4831-953c-dfcaef743089">struct</a></b> with fields:<br>
<br>
method: 'bemcp'<br>
conductivity: [0.3333 0.0167 0.3333]</div>
</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Any suggestions would be appreciated!</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thank you, </div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="direction: ltr; font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Erin </div>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1561.6">
<style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Times; color: #000000; -webkit-text-stroke: #000000; min-height: 14.0px}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Times; color: #000000; -webkit-text-stroke: #000000}
    span.s1 {font-kerning: none}
    span.s2 {text-decoration: underline ; font-kerning: none; color: #0000ee; -webkit-text-stroke: 0px #0000ee}
  </style>
<p class="p1"><span class="s1"></span><br>
</p>
<p class="p1"><span class="s1"></span><br>
</p>
<p class="p2"><span class="s1"><i>När du skickar e-post till Karolinska Institutet (KI) innebär detta att KI kommer att behandla dina personuppgifter.
</i><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fki.se%2Fom-ki%2Fintegritetsskyddspolicy&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cbf798709914641d539fc08de59b52bd3%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C639046831803488253%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=cv2gGPUj32QNIZ0HTwEFAWfQEnJlxVB1CQ6QLJBph5s%3D&reserved=0" originalSrc="https://ki.se/om-ki/integritetsskyddspolicy"><span class="s2">Här finns information om hur KI behandlar personuppgifter</span></a>.<span class="Apple-converted-space"> </span></span></p>
<p class="p1"><span class="s1"></span><br>
</p>
<p class="p2"><span class="s1"><i>Sending email to Karolinska Institutet (KI) will result in KI processing your personal data.</i>
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstaff.ki.se%2Fdata-protection-policy&data=05%7C02%7Cfieldtrip%40science.ru.nl%7Cbf798709914641d539fc08de59b52bd3%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C639046831803508499%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=hAFdeeRZapy1XrXpObId7DNycQ6Gu8IYWPsqB52AWIw%3D&reserved=0" originalSrc="https://staff.ki.se/data-protection-policy"><span class="s2">You can read more about KI’s processing of personal data here</span></a>.<span class="Apple-converted-space"> </span></span></p>
</body>
</html>