FreeMat: WHERE Get Information on Program Stack

FreeMat

- Main Page
- Related Pages

WHERE Get Information on Program Stack

Section: Inspection Functions

# Usage

Returns information on the current stack. The usage is

       where

The result is a kind of stack trace that indicates the state of the current call stack, and where you are relative to the stack.

# Example

Suppose we have the following chain of functions.

         chain1.m

    function chain1
      a = 32;
      b = a + 5;
      chain2(b)

         chain2.m

    function chain2(d)
      d = d + 5;
      chain3

         chain3.m

    function chain3
      g = 54;
      f = g + 1;
      keyboard

The execution of the `where` command shows the stack trace.

    --> chain1
    [chain3,4]--> where
    In /home/sbasu/Devel/FreeMat4/doc/fragments/chain3.m(chain3) at line 4
        In /home/sbasu/Devel/FreeMat4/doc/fragments/chain2.m(chain2) at line 4
        In /home/sbasu/Devel/FreeMat4/doc/fragments/chain1.m(chain1) at line 4
        In scratch() at line 2
        In base(base)
        In base()
        In global()
    [chain3,4]