MATLAB: Does tab complete not work for user written functions that except filenames

completetab

Why does tab complete not work for user written functions that except filenames?
function testFunction(file)
disp(file)
end %end function
Call the above function with a file. While entering the file name, try to tab complete it. It won't work. Why not?

Best Answer

The rules for tab completion are not well defined, and do not always make sense.
Tab completion for a quoted string takes place if:
  • the quoted string is the first expression (possibly after whitespace) after the beginning of the line, or after a comma (",") or semi-colon (";") that marks the end of anything previous on the line
  • the quoted string immediately follows (no whitespace) a non-quoted underscore ('_') or period ('.')
  • the quoted string immediately follows (no whitespace) a latin letter or latin digit
In addition, there are circumstances under which a quoted string that follows an exclamation mark ('!') may lead to a flawed tab completion, in which the resulting word is missing one or more characters from the file name.
None of the above situations match attempting to enter a valid quoted string as the argument to a function. :(
Related Question