Simulink.data.assigninGlobal
Modify variable values in context of Simulink model
Description
Simulink.data.assigninGlobal(
assigns the value modelName
,varName
,varValue
)varValue
to the variable
varName
within the context of the Simulink® model modelName
. This function updates all
instances of the variable varName
in the data sources, including
data dictionary and MAT files associated with the model
modelName
.
If the variable does not exist, the function creates the variable in the following manner:
If a data dictionary is linked to the model as an external data source, the function creates an entry in the Design Data section of the dictionary.
If both a MAT file and a data dictionary are linked to the model as external data sources, the function creates an entry in the Design Data section of the dictionary.
If only a MAT file is linked to the model as an external data source, the function creates an entry in the MAT file.
If multiple MAT files are linked to the model as external data sources, the function reports an error.
If no external data sources are linked to the model, the function creates a variable in the MATLAB® base workspace.
If the model is linked to a data dictionary that references other dictionaries, the function searches for the variable in the entire dictionary hierarchy. If it does not find a matching variable, the function creates an entry in the dictionary that is linked to the model.
Examples
Input Arguments
Version History
Introduced in R2015a