<div dir="ltr">Dear Alina,<div><br></div><div>Not sure there is not something more sinister at play in the code somewhere (I mean a bug or installation error), but I would start by asking why you are using
<i style="color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px">ft_read_header </i>to load a .mat file?</div><div><br></div><div>Are you sure you don't just want to load the matfile with MATLAB's load functions? I.e. header = load('myfilename.mat')? Or, otherwise, read the header of an original EEG/MEG datafile (some EEG/MEG dataformat)?</div><div><br></div><div>If not, and for a more informed response, please specify a bit more of the code you use to process/write and then (try to) load the header.</div><div><br></div><div>Cheers,</div><div>Stephen</div><div><br></div><div> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Op di 23 jun. 2020 om 13:30 schreef Bondarenko, Alina I <<a href="mailto:alina.bondarenko19@imperial.ac.uk">alina.bondarenko19@imperial.ac.uk</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div 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>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div>