Main Content

Simulink.data.dataSource.hasSource

Determine if specified external data source is associated with model

Since R2024b

Description

tf = Simulink.data.dataSource.hasSource(modelName,nameOfExternalSource) checks whether a specified external data source, such as a MAT file or a data dictionary, is currently associated with the Simulink® model or Subsystem File specified by modelName.

example

Examples

collapse all

Determine if the external data source BasicModellingDataDefinitions.mat is added to the model BasicModellingData.

isAttached = Simulink.data.dataSource.hasSource("BasicModellingData","BasicModellingDataDefinitions.mat")
isAttached = 

logical
    1

Determine if the external data source myDictionary.sldd is added to the Subsystem File SSREF1.

isAttached = Simulink.data.dataSource.hasSource("SSREF1","myDictionary.sldd")
isAttached = 

logical
    0

Input Arguments

collapse all

Path or handle of a model or subsystem file, specified as a character vector or string.

Example: "myModel"

Data Types: char | string

Name of the external data source, specified as a character vector or string. Data source can be a MAT file or a data dictionary.

  • MAT file — Name of MAT file, including file extension

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

Example: "myMatFile.mat"

Example: "myDictionary.sldd"

Data Types: char | string

Output Arguments

collapse all

True or false result, returned as 1 or 0 of data type logical.

Alternatives

Use Model Explorer to navigate to the External Data tab. Under Additional data sources, you can check for the data source.

Version History

Introduced in R2024b