Overload List
| # | Signature | Description |
|---|---|---|
| 1 | function DefineVariable(const AVarName: string): TValueRec; | Defines new variable. |
| 2 | function DefineVariable(const AVarName: string; const aVar: TValueRec): TValueRec; | Defines new variable of arbitrary type. |
Overload 1: function DefineVariable(const AVarName: string): TValueRec;
Defines new variable.
| # | Name | Description |
|---|---|---|
| 1 | AVarName | Defines variable name. Type of variable (double/complex/vector/matrix) must be defined before any Evaluate method will be called. If variable with name AVarName was already defined, it will be redefined and all expressions which contain the symbol AVarName will be recompiled before the next evaluation. |
Returns: TValueRec
See Also: TMtxExpression.Undefine, TMtxExpression.VarByName, TMtxExpression.GetVarList, TMtxExpression.DefineDouble, TMtxExpression.DefineComplex, TMtxExpression.DefineVector, TMtxExpression.DefineMatrix, TMtxExpression.DefineFunction, TMtxExpression.DefineVaryingFunction, TMtxExpression.DefineOperator, TMtxExpression.DefineDoubleConstant, TMtxExpression.DefineComplexConstant
Overload 2: function DefineVariable(const AVarName: string; const aVar: TValueRec): TValueRec;
Defines new variable of arbitrary type.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | AVarName | string | |
| 2 | aVar | TValueRec |
Returns: TValueRec
Remarks:
Use this method to define Global variables, which are shared between multiple expression objects. aVar can be constructed externally and then passed to multiple TMtxExpression objects. The name of the variable can be equal or different between TMtxExpression objects, but the value will be modified concurrently and be the same in all. This value is stored in the aVar object. The type does not need to be defined upfront, but once defined an attempt for the script to change the type will be blocked. The type can be reset to undefined with a call to aVar.Undefine.