<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello all,<br>
<br>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif">
<br>
I'll try to describe the problem I've been having as clearly as I can here:</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif">
<ul>
<li>I'm trying to use a Field Trip function<span> </span><i>ft_read_header<span> </span></i>to load some .mat files.<br>
<br>
</li><li>When I try to load up a file using<span> </span><i>ft_read_header,</i><span> </span>I get an error message saying that within the<span> </span><i>ft_read_header<span> </span></i>script, the function<span> </span><i>feval</i> is being used incorrectly. Namely,
 that<span> </span><i>feval</i> is trying to execute a script called<span> </span><i>matlab</i> as if it were a function. <br>
<br>
<span style="margin: 0px; color: rgb(134, 17, 6)">Error using feval</span><span style="margin: 0px"><br>
</span>
<div style="margin: 0px"><span style="margin: 0px; color: rgb(134, 17, 6)">Attempt to execute SCRIPT matlab as a function:</span><br>
</div>
<span style="margin: 0px; color: rgb(134, 17, 6)">/Applications/MATLAB_R2019b.app/toolbox/matlab/general/matlab.m</span><br>
<br>
</li><li>When I look inside the<span> </span><i>ft_read_header</i><span> </span>script, the line (2594) that gives the error looks like this:<br>
<br>
<span style="margin: 0px; color: rgb(23, 78, 134)">feval(headerformat, filename)</span><br>
<br>
Where<span> </span><i>headerformat</i><span> </span>is assigned a string 'matlab', which is supposed to represent the file type of the file I'm trying to load. Filename is a string variable I assign, e.g. filename = 'session1.mat'. <br>
<br>
Headerformat is assigned the string 'matlab' in line 203 of<span> </span><i>ft_read_header </i>(found in debugging mode):<br>
<br>
<span style="margin: 0px; color: rgb(23, 78, 134)">headerformat = ft_filetype(filename);</span><br>
<br>
 </li><li>Feval is supposed to "evaluate a function" (I'm not quite sure exactly what this means based on the documentation), but it's first argument is supposed to be a function name, so I guess that a string saying 'matlab' should have always thrown an error, but
 the thing is that this function used to work just fine for me before. I also haven't edited any of the built in Field Trip scripts, so I'm not sure why this has stopped working. <br>
<br>
</li></ul>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif">
<b><br>
</b></div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif">
Here are some things I've tried to fix the problem:</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif">
<br>
</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif">
<ul style="font-size: 16px; background-color: rgb(255, 255, 255)">
<li><span style="margin: 0px">
<div style="margin: 0px; font-size: 12pt">
<div style="margin: 0px"><span style="margin: 0px">I looked up the 'executing script as function error' and thought that since Matlab would like to execute a function, but is instead executing a script of the same name, then changing the name of the script
 could stop the problem.<br>
<br>
However, when I change the name of the matlab.m script (e.g. to matlab_change.m) I get this error message instead:<br>
<br>
</span><span style="margin: 0px; color: rgb(134, 17, 6)">Error using feval</span><span style="margin: 0px"><br>
</span><span style="margin: 0px; color: rgb(134, 17, 6)">Previously accessible file</span><br>
<span style="margin: 0px; color: rgb(134, 17, 6)">"/Applications/MATLAB_R2019b.app/toolbox/matlab/general/matlab.m" is now inaccessible.</span><br>
</div>
</div>
<div style="margin: 0px; font-size: 12pt"><span style="margin: 0px"><br>
The only file called matlab.m is a short text file containing some info about what Matlab is and what it can be used for (I used "</span><i>which matlab -all"</i><span style="margin: 0px"> to check this). There are no functions called matlab. <br>
<br>
</span></div>
</span></li><li><span style="margin: 0px">In between the time when this function was working fine for me, and when it started showing me this error, I installed several versions of OSL and SPM on my computer. So, I uninstalled all these things.</span></li><li><span style="margin: 0px">Uninstalled and reinstalled Field Trip</span></li><li><span style="margin: 0px">Uninstalled and reinstalled Matlab</span></li><li><span style="margin: 0px">Copy pasted all the functions involved and saved these under different names in different folders. Tried running them - got the same error. <br>
</span></li></ul>
<div><span style="margin: 0px"><br>
</span></div>
<div><span style="margin: 0px">I would greatly appreciate anyone's help on this! This error has been driving me crazy.<br>
<br>
All the best,<br>
Alina. </span></div>
<br>
</div>
<br>
</div>
</body>
</html>