mphevaluate
Evaluate parameter expressions in models.
Syntax
mphevaluate(model,expr)
str = mphevaluate(model)
[value,unit,def,descr] = mphevaluate(model,expr,...)
[value,...] = mphevaluate(model,expr,unit)
[value,...] = mphevaluate(model,expr,asvalue)
Description
mphevaluate(model,expr) evaluates the expression expr defined in the Parameters node.
str = mphevaluate(model) returns all the expressions defined in the Parameters node as a structs arrays.
str = mphevaluate(model,{e1,...}) returns all the expressions defined in the cell array {e1,...} as a structs arrays. When multiple expressions are evaluated only one output is supported.
[value,unit,def,descr] = mphevaluate(model,expr,...) evaluates the expression expr and return the unit (unit), the definition in the model (def) and the description (descr).
[value,...] = mphevaluate(model,expr,unit) evaluates the expression expr in the unit defined by unit.
value = mphevaluate(model,expr,unit,'value') returns only the value of the expression expr.
unit = mphevaluate(model,expr,unit,'unit') returns only the unit of the expression expr.
def = mphevaluate(model,expr,unit,'valueunit') returns as a string the value and the unit of the expression expr. This is useful to set a new parameter based on an existing one.
The evaluation does not require an existing solution dataset in the model.
Example
Evaluate the parameter power defined in the model:
model = mphopen('model_tutorial_llmatlab');
power = mphevaluate(model,'power');
Evaluate Temp in degrees Celsius and its definition in the model:
[Temp,unit,def] = mphevaluate(model,'Temp','degC');
Evaluate an expression of parameters:
Temp = mphevaluate(model,'Temp+20[degC]','degF');
See also
mpheval, mphglobal, mphinterp, mphparticle, mphray