Main Content

discardChanges

Discard changes to Simulink data dictionary

Since R2023b

    Description

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

    example

    Examples

    collapse all

    Add a new enumeration data type to the Architectural Data section of a data dictionary and then discard the changes.

    Open the data dictionary MyInterfaces.sldd and use the isDirty function to verify that the data dictionary does not contain changes.

    archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd");
    isDirty(archDataObj)
    ans =
    
      logical
    
       0

    Add enumeration data type, MyEnum.

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

    Discard the change.

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

    Input Arguments

    collapse all

    Architectural Data object, specified as a Simulink.dictionary.ArchitecturalData object.

    Version History

    Introduced in R2023b