MATLAB: Exist() for functions only

2builtinexistexist functionfunction

As I understand, the exist() function in MATLAB will return "2" if the input is a MATLAB function.
The list of options for the second input 'kind' are builtin, class, dir, file, and var.
I want to input 'kind' so that exist() will ONLY search for functions, and return 2 if it is a match to a function and a 0 if not.
Is there any way to do this?

Best Answer

An option that is not exactly what you describe, but might work for you:
isempty(which([functionname,'.m']))