Main Content

Simulink.data.dictionary.Entry

Configure data dictionary entry

Description

An object of the Simulink.data.dictionary.Entry class represents one entry of a data dictionary. The object allows you to perform operations such as assign the entry a value or change the name of the entry.

Before you can create a new Simulink.data.dictionary.Entry object, you must create a Simulink.data.dictionary.Section object representing the data dictionary section that contains the target entry. However, once created, the Simulink.data.dictionary.Entry object exists independently of the Simulink.data.dictionary.Section object. Use the function getSection to create a Simulink.data.dictionary.Section object.

Creation

Syntax

Description

The functions addEntry, getEntry, and find create Simulink.data.dictionary.Entry objects.

Properties

expand all

File name of containing data dictionary, specified as a character vector. Changes you make to this property affect the represented data dictionary entry.

Example: 'myDictionary.sldd'

Data Types: char

Date and time of last modification to entry, returned in Coordinated Universal Time (UTC) as a character vector. This property is read only.

Name of last user to modify entry, returned as a character vector. This property is read only.

Name of entry, specified as a character vector. Changes you make to this property affect the represented data dictionary entry.

Data Types: char

State of entry, returned as 'New', 'Modified', 'Unchanged', or 'Deleted'. The state is valid since the last data dictionary save. If the state is 'Deleted', the represented entry was deleted from its data dictionary. This property is read only.

Object Functions

deleteEntryDelete data dictionary entry
discardChangesDiscard changes to data dictionary entry
find Search in array of data dictionary entries
getValueReturn value of data dictionary entry
setValueSet value of data dictionary entry
showChangesDisplay changes made to data dictionary entry

Examples

collapse all

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

myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd');
dDataSectObj = getSection(myDictionaryObj,'Design Data');

Add an entry myEntry with value 27 to the Design Data section of myDictionary_ex_API.sldd. Assign the returned Simulink.data.dictionary.Entry object to variable e.

e = addEntry(dDataSectObj,'myEntry',27)
e = 

  Entry with properties:

              Name: 'myEntry'
             Value: 27
        DataSource: 'myDictionary_ex_API.sldd'
      LastModified: '2014-Aug-26 18:42:08.439709'
    LastModifiedBy: 'jsmith'
            Status: 'New'

Change the value of myEntry from 27 to the character vector 'My New Value'.

setValue(e,'My New Value')
e
e = 

  Entry with properties:

              Name: 'myEntry'
             Value: 'My New Value'
        DataSource: 'myDictionary_ex_API.sldd'
      LastModified: '2014-Aug-26 18:45:58.336598'
    LastModifiedBy: 'jsmith'
            Status: 'New'

Represent the data dictionary entry fuelFlow with a Simulink.data.dictionary.Entry object named fuelFlowObj. fuelFlow is defined in the data dictionary myDictionary_ex_API.sldd.

myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd');
dDataSectObj = getSection(myDictionaryObj,'Design Data');
fuelFlowObj = getEntry(dDataSectObj,'fuelFlow');

Return the value of the entry fuelFlow and assign the value to the variable fuelFlowValue.

fuelFlowValue = getValue(fuelFlowObj)
fuelFlowValue =

   237

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

myDictionaryObj = Simulink.data.dictionary.open('myDictionary_ex_API.sldd');
dDataSectObj = getSection(myDictionaryObj,'Design Data');

Create a Simulink.data.dictionary.Entry object representing the entry fuelFlow, which resides in myDictionary_ex_API.sldd. Assign the object to variable e.

e = getEntry(dDataSectObj,'fuelFlow')
e = 

  Entry with properties:

              Name: 'fuelFlow'
             Value: 237
        DataSource: 'myDictionary_ex_API.sldd'
      LastModified: '2014-Sep-05 13:12:06.099278'
    LastModifiedBy: 'jsmith'
            Status: 'Unchanged'

Migrate the entry fuelFlow to the reference data dictionary myRefDictionary_ex_API.sldd by modifying the DataSource property of e.

e.DataSource = 'myRefDictionary_ex_API.sldd'
e = 

  Entry with properties:

              Name: 'fuelFlow'
             Value: 237
        DataSource: 'myRefDictionary_ex_API.sldd'
      LastModified: '2014-Sep-05 13:12:06.099278'
    LastModifiedBy: 'jsmith'
            Status: 'Modified'

Because myDictionary_ex_API.sldd references myRefDictionary_ex_API.sldd, both dictionaries belong to the same dictionary hierarchy, allowing you to migrate the entry fuelFlow between them.

Version History

Introduced in R2015a