Question: In Matlab, how can I check if a function handle is a particular function or function type?
Example: Let f1
be a function handle. How do I check if f1
is the in-built Matlab function mean
? How do I check if f1
is an anonymous function?
My Current Solution: My current solution to this problem involves a call to the functions
function. functions
accepts a function handle as input and returns a structure containing information about the input function handle, eg function type, path, function name etc. It works, but it is not an ideal solution because, to quote the official documentation:
"Caution MATLAB® provides the functions
function for querying and debugging purposes only. Because its behavior may change in subsequent releases, you should not rely upon it for programming purposes."