Error using spm_existfile: Input must be a string

A function that I am using is using spm_existfile in the background. Currently, I always get this error:

Error using spm_existfile
Input must be a string.

This is strange, because 1.) I cannot find the error message in the function definition itself and 2.) spm_existfile is just a thin wrapper around s = exist(filename,'file') > 0. When I only execute this code everything works fine (i.e. s = 1).

Does anyone know what’s going on here? The only guess that I have right now is that it must have something to do with this note from the docs:

% This compiled routine is equivalent to:
% >> s = exist(filename,‘file’) == 2;
% and was written for speed purposes. The differences in behaviour are that
% spm_existfile does not look in MATLAB’s search path and does not perform
% tilde ‘~’ expansion.

P.S.: I am using Ubuntu 22.04

It is the double quotes.

>> spm_existfile("ds003_downsampled.tar")
Error using spm_existfile
Input must be a string. 

>> spm_existfile('ds003_downsampled.tar')
ans =

>> class("foo")
ans =

>> class('foo')
ans =
1 Like

this always gets me when I switch between python and matlab especially that I only use “blacked” python so I live in a world of double quotes.

1 Like