[FieldTrip] Error using ft_read_header

Bondarenko, Alina I alina.bondarenko19 at imperial.ac.uk
Tue Jun 23 13:23:04 CEST 2020


Hello all,


I'll try to describe the problem I've been having as clearly as I can here:

  *   I'm trying to use a Field Trip function ft_read_header to load some .mat files.

  *   When I try to load up a file using ft_read_header, I get an error message saying that within the ft_read_header script, the function feval is being used incorrectly. Namely, that feval is trying to execute a script called matlab as if it were a function.

Error using feval
Attempt to execute SCRIPT matlab as a function:
/Applications/MATLAB_R2019b.app/toolbox/matlab/general/matlab.m

  *   When I look inside the ft_read_header script, the line (2594) that gives the error looks like this:

feval(headerformat, filename)

Where headerformat 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'.

Headerformat is assigned the string 'matlab' in line 203 of ft_read_header (found in debugging mode):

headerformat = ft_filetype(filename);


  *   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.


Here are some things I've tried to fix the problem:


  *
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.

However, when I change the name of the matlab.m script (e.g. to matlab_change.m) I get this error message instead:

Error using feval
Previously accessible file
"/Applications/MATLAB_R2019b.app/toolbox/matlab/general/matlab.m" is now inaccessible.

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 "which matlab -all" to check this). There are no functions called matlab.

  *   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.
  *   Uninstalled and reinstalled Field Trip
  *   Uninstalled and reinstalled Matlab
  *   Copy pasted all the functions involved and saved these under different names in different folders. Tried running them - got the same error.

I would greatly appreciate anyone's help on this! This error has been driving me crazy.

All the best,
Alina.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200623/f7877928/attachment.htm>


More information about the fieldtrip mailing list