set
R2026bDescription
set(
assigns the values connectionObj,varNames,varValues)varValues to the variables
varNames in the connected data source
connectionObj.
When the connected data source is the Configurations section of a
If the data connection can access multiple definitions of the same variable (for example, in a data dictionary and in a referenced dictionary), the function updates the value for all definitions of the variable. If the variable does not exist in a data source visible to the data connection, then the function creates the variable in the directly connected data source.
Note
When you assign a Simulink.ConfigSet object to a variable or rename
a variable that is set to a Simulink.ConfigSet object, Simulink® updates the Name property of that object to match the
variable name.
Examples
Input Arguments
Tips
You can also read and assign values to variables by using dot notation. For example:
dc_dd = Simulink.data.connect("myDictionary.sldd") dc_dd.x = 1; dc_dd.xans = 1For better performance, when setting multiple variables in a connected data source, call the
setfunction once with a vector of the variable names rather than calling the function for each variable individually.The data connection object does not provide direct access to individual model configuration parameters. To read or change the value of a configuration parameter, use the
get_paramandset_paramobject functions. For example:% Create connection to section in data dictionary d1 = Simulink.data.connect("a.sldd",Section="Configurations"); % Create a new configuration set d1.config = Simulink.ConfigSet; % Change the value of the Solver configuration parameter config = d1.config; set_param(config, "Solver","ode45"); % Assign modified configuration set to the Configurations section of the data dictionary d1.config = config;
Version History
Introduced in R2024a