Main Content


Assign value to data dictionary entry



assignin(sectionObj,entryName,entryValue) assigns the value entryValue to the data dictionary entry entryName in the data dictionary section sectionObj, a object. If an entry with the specified name is not in the target section, assignin creates the entry with the specified name and value.

If an entry with the name specified by input argument entryName is not defined in the target data dictionary section but is defined in a referenced dictionary, assignin does not create a new entry in the target section but operates on the entry in the referenced dictionary.

To programmatically access variables for the purpose of sweeping block parameter values, consider using Simulink.SimulationInput objects instead of modifying the variables through the programmatic interface of the data dictionary. See Optimize, Estimate, and Sweep Block Parameter Values.


collapse all

Assign a value to a data dictionary entry by operating on a object.

Represent the Design Data section of the data dictionary myDictionary_ex_API.sldd with a object named dDataSectObj.

myDictionaryObj ='myDictionary_ex_API.sldd');
dDataSectObj = getSection(myDictionaryObj,'Design Data');

Assign the value 237 to an entry myAssignedEntry in the data dictionary myDictionary_ex_API.sldd. If an entry named myAssignedEntry is not in myDictionary_ex_API.sldd, create it.


Input Arguments

collapse all

Target data dictionary section, specified as a object. Before you use this function, represent the target section with a object by using, for example, the getSection function.

Name of target data dictionary entry, specified as a character vector. If a matching entry does not already exist, the functions creates a new entry using the specified name.

Example: 'myEntry'

Data Types: char

Value to assign to data dictionary entry, specified as a MATLAB expression that returns any valid data dictionary content.

Example: 27.5

Example: myBaseWorkspaceVariable

Example: Simulink.Parameter


You can use the Model Explorer window to view and change the values of data dictionary entries.

Introduced in R2015a