Main Content

Create object for a data source

Since R2024a



    connectionObj = creates a data connection object for a data dictionary, model workspace, or base workspace. The function returns a object representing the connection to the data source.


    connectionObj =,TabComplete=tcOption) specifies whether tab completion for the object provides methods, variables, or both methods and variables. Once you create a connection to the data source, your tab completion preference cannot be changed.


    collapse all

      dd ='myDictionary.sldd')
      dd = 
      DataConnection to myDictionary.sldd

    Create a data connection to the model workspace for model vdp.

    mw ="vdp.slx")
    mw = 
    DataConnection to vdp.slx

    Create a data connection to the base workspace and configure tab completion to show only variables in the connected data source.

    bw ='base workspace', TabComplete = 'Vars')
    bw = 
    DataConnectionTCV to base workspace

    Input Arguments

    collapse all

    Name of data source, specified as a string or character vector. Data source can be a data dictionary, model workspace, or base workspace.

    • Data dictionary — Name of data dictionary, including file extension

    • Model workspace — Name of model, including file extension

    • Base workspace — 'base workspace'

    Example: 'myDictionary.sldd'

    Example: "vdp.slx"

    Example: 'base workspace'

    Tab completion preference, specified as 'Methods', 'Vars', or 'All'. By default, tab completion displays the methods available for the connected data source. To configure tab completion to display variables available in the data source, specify 'Vars'. To configure tab completion to display both methods and variables for the data source, specify 'All'.

    Output Arguments

    collapse all

    Connection to data source, returned as a object. If you specify tcOptions as either 'Vars' or 'All', the connection is returned as a or object, respectively. and are both inherited from and support the same methods.

    Version History

    Introduced in R2024a