MATLAB Function Reference | ![]() ![]() |
Constructs a function name string from a function handle
Syntax
s = func2str(fhandle)
Description
func2str(fhandle)
constructs a string, s
, that holds the name of the function to which the function handle, fhandle
, belongs.
When you need to perform a string operation, such as compare or display, on a function handle, you can use func2str
to construct a string bearing the function name.
The func2str
command also operates on MATLAB data structures that hold more than one function handle, (for example, arrays). It returns the names of all function handles in the data structure. These names are contained in a cell array of strings.
Examples
To create a function name string from the function handle, @humps
funname = func2str(@humps) funname = humps
To create a cell array of function names from an array of function handles
func_array = func2str([@sin @cos @tan]) func_array = 'sin' 'cos' 'tan'
See Also
function_handle
, str2func
, functions
![]() | fullfile | function | ![]() |