Main Content

Evaluate MATLAB expression in context of Simulink model



returnValue =,expression) evaluates the MATLAB expression expression in the context of the Simulink model modelName and returns the values returned by expression. evalinGlobal evaluates expression in the Design Data section of the data dictionary that is linked to the target model or in the MATLAB base workspace if the target model is not linked to any data dictionary.


collapse all

Evaluate the MATLAB expression myNewVariable = 237; in the context of the model vdp, which is not linked to any data dictionary. myNewVariable appears as a variable in the MATLAB base workspace.'vdp','myNewVariable = 237;')

Evaluate the MATLAB expression myNewEntry = true; in the context of the model sldemo_fuelsys_dd_controller, which is linked to the data dictionary sldemo_fuelsys_dd_controller.sldd. myNewEntry appears as an entry in the Design Data section of the dictionary.

'myNewEntry = true;')

Confirm the creation of the entry myNewEntry in the data dictionary sldemo_fuelsys_dd_controller.sldd by viewing the dictionary in Model Explorer.

myDictionaryObj =

Input Arguments

collapse all

Name of target Simulink model, specified as a character vector.

Example: 'myTestModel'

Data Types: char

MATLAB expression to evaluate, specified as a character vector.

Example: 'a = 5.3'

Example: 'whos'

Example: 'CurrentSpeed.Value = 290.73'

Data Types: char

Output Arguments

collapse all

Value returned by the specified MATLAB expression.


  • evalinGlobal helps you transition Simulink models to the use of data dictionaries. You can use the function to manipulate model variables before and after linking a model to a data dictionary.

Version History

Introduced in R2015a