Contents - Index
The CallMacro is similar in format and function to the Call statement used to access an Internal Procedure or External Procedure. The difference is that the CallMacro statement will run a macro that exists in the Macro Window. Although the macro file that is called can use any of the available macro commands, CallMacro is intended to only use the commands that call and return values from other programs, such as MATLAB.
The format of the CallMacro statement is
CallMacro MacroName(Input1, Input2, ... : Output1, Output2...)
MacroName is the name on the tab of a set of macro commands in the Macro Window.
The inputs and outputs are separated by a colon (:) as in internal and external Procedures. Note that the CallMacro statement may only be used in the Main program and the inputs and outputs are variables in the Main program. Note that the input and output variables are not transferred to and from the macro in the usual manner. The values of the inputs are assumed to be known at the start of the macro call. The output values MUST be set within the macro. The real purpose for providing the list of inputs and outputs is to allow EES to properly block the equations so that it can call the macro at the appropriate point in the calculations.
Two macros are called. The macros, labelled matlabmacro1.emf and matlabmacro2.emf are listed below
NewLookup Lookup Rows=5 Cols=5
The following EES program calls these two macros
A[1,1..N] = [2, 3, 1]
A[2,1..N] = [8, 5, 1]
A[3,1..N] = [7, 1, 2]
CallMacro matlabmacro2(N, A[1..3,1..3],B[1..N]:x[1..3],Ab[1..3])
A Lookup table containing the matrix ar is created. The x and Ab arrays are determined by the macros and shown in the Arrays window.