Main Content

discardChanges

Discard changes to interface dictionary

Since R2023a

In R2023b the Architectural Data section of data dictionaries was introduced. When managing interfaces, data types, constants, and software address methods consider using the Simulink.dictionary.ArchitecturalData programmatic interfaces instead. For more information, see Programmatically Manage AUTOSAR Architectural Data.

Description

discardChanges(dictObj) discards any changes made to the interface dictionary dictObj since the last time the dictionary was saved.

example

Examples

collapse all

Add a new enumeration type to an interface dictionary and then discard the changes.

Verify that the dictionary does not contain changes.

dictAPI = Simulink.interface.dictionary.open('MyInterfaces.sldd');
isDirty(dictAPI)
ans =
  logical
   0

Add enumeration type, MyEnum.

addEnumType(dictAPI,'MyEnum');
getDataTypeNames(dictAPI)
ans =
  1×8 cell array
  Columns 1 through 5
    {'MyEnum'}    {'myAliasType1'}    {'myAliasType2'}    {'myAliasType3'}    {'myColor'}
  Columns 6 through 8
    {'myStructType1'}    {'myStructType2'}    {'myValueType1'}

Discard the change.

discardChanges(dictAPI);
getDataTypeNames(dictAPI)
ans =
  1×7 cell array
  Columns 1 through 4
    {'myAliasType1'}    {'myAliasType2'}    {'myAliasType3'}    {'myColor'}
  Columns 5 through 7
    {'myStructType1'}    {'myStructType2'}    {'myValueType1'}

Input Arguments

collapse all

Interface dictionary, specified as a Simulink.interface.Dictionary object. Before you use this function, create or open dictObj by using Simulink.interface.dictionary.create or Simulink.interface.dictionary.open.

Version History

Introduced in R2023a

collapse all

R2023b: Simulink.interface.Dictionary object replaced by Simulink.dictionary.ArchitecturalData object

Starting in R2023b, use the Simulink.dictionary.ArchitecturalData object to programmatically manage architectural data instead of the Simulink.interface.Dictionary object.