Main Content

Simulink.data.DataConnection

Data source connection

Since R2024a

    Description

    The Simulink.data.connect function creates a Simulink.data.DataConnection object, which represents a connection to a Simulink data dictionary, model workspace, or base workspace. After you create a Simulink.data.DataConnection object, you can manage the data in that data source using the object functions.

    Creation

    Create a data connection object using Simulink.data.connect.

    Object Functions

    clearRemove specified variables from connected data source
    clearAllRemove variables from connected data source
    createCreate object in connected data source
    discardChangesDiscard data in memory and reload from connected data source
    existDetermine whether variable exists in connected data source
    getRead variables from connected data source
    getMetadataGet metadata for variable or connected data source
    hasUnsavedChangesDetermine whether connected data source has unsaved data in memory
    isConsistentDetermine whether variable definitions visible to connected data source are consistent
    renameRename specified variables in connected data source
    reportInconsistencyReport inconsistent variable definitions
    saveChangesSave data in memory for connected data source to disk
    setAssign variable in connected data source
    showOpen and show contents of connected data source in Model Explorer
    whoList variables that are in connected data source

    Examples

    collapse all

    • Create a connection to a data dictionary myDictionary. Then read a variable from the Design Data section of the dictionary.

      dd = Simulink.data.connect('myDictionary.sldd');
      a = dd.x
      a = 
      
          2

    Version History

    Introduced in R2024a