FUNCTION REFERENCE

str2func

Make a function handle from text.

Make a function handle from text.

Syntax

f = str2func('name')

Syntax

f = str2func('@(x) expression')

A name gives a handle to that function; text starting with @ gives an anonymous function. Variables in the text are not captured from the workspace.

Example

f = str2func('@(x) x + 1'); f(2)   % 3

Differences from MATLAB: none known.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.