FreeMat
FUNC2STR Function to String conversion

Section: Functions and Scripts

Usage

The func2str function converts a function pointer into a string. The syntax is

    y = func2str(funcptr)

where funcptr is a function pointer. If funcptr is a pointer to a function, then y is the name of the function. On the other hand, if funcptr is an anonymous function then func2str returns the definition of the anonymous function.

Example

Here is a simple example of using func2str

--> y = @sin

y = 
 @sin
--> x = func2str(y)

x = 
sin

If we use an anonymous function, then func2str returns the definition of the anonymous function

--> y = @(x) x.^2

y = 
 @(x)   x.^2
--> x = func2str(y)

x = 
 @(x)   x.^2