str2func
Returns the function handle corresponding to the input string argument s. If an optional second argument called global is given, only global functions are included in the scope of the lookup.
Syntax
R = str2func(s)
R = str2func(s, 'global')
Inputs
- s
- Function name.
Outputs
- R
- Type: Function handle.
Examples
function testfunc()
disp('test')
end
str2func('testfunc')
R = testfunc
R = str2func('sqrt')
R = sqrt