evalin

Same as eval except variable or expression is evaluated in context. Context is either 'caller' or 'base'.

Syntax

evalin(context, try, catch)

Inputs

context
Can be either 'caller' or 'base'.
Type: char | string
Dimension: string
try
Script statements that will be executed in the proper scope.
Type: char | string
Dimension: string
catch (optional)
Script statements that will be executed if an error occurs while executing try.
Type: char | string
Dimension: string

Examples

Caller evalin example:

        function tocall
          evalin('caller', 'x=3;');
        end

        function go
          x=2;
          tocall
          x
        end

        x=1;
        go;
        x
          x = 3
          x = 1
Base evalin example:
        function tocall
        evalin('base', 'x=3;');
        end

        function go
        x=2;
        tocall
        x
        end

        x=1;
        go;
        x
         x = 2
          x = 3