Main Content

Simulink.data.resolveInGlobal

Resolve MATLAB expression in context of Simulink model

Since R2024b

Description

value = Simulink.data.resolveInGlobal(modelName,expression) evaluates the given expression or variable name associated within the context of the Simulink® model or a Subsystem Reference block specified by modelName. This includes data from the base workspace and the external data sources linked to the model, such as a Simulink data dictionary or MAT files.

example

Examples

collapse all

Evaluate a MATLAB® expression with the variable k in the context of the Simulink model BasicModellingData.slx.

openExample("BasicModellingData")
value = Simulink.data.resolveInGlobal("BasicModellingData","k*2")
value =

      10

Input Arguments

collapse all

Model name or path to Subsystem Reference in the model, specified as a character vector or a string.

Example: "myModel"

Data Types: char | string

MATLAB expression to evaluate, specified as a character vector.

Example: 'a == 5.3'

Example: 'Param*199+sqrt(100)/1000'

Data Types: char | string

Version History

Introduced in R2024b