主要内容

digitalthread.uri.simulink.fromObject

R2026b

Get digital thread URI from Simulink or Stateflow object

Since R2026b

    Description

    uri = digitalthread.uri.simulink.fromObject(storageMap,obj) returns the digital thread URI for the Simulink® or Stateflow® object specified by obj.

    A digital thread URI is a stable identifier for an artifact, such as a model, or an artifact within that file, such as a block. The digital thread uses these URIs as a consistent way to refer to artifacts across tools and inside metric results.

    Use this function to find the digital thread URI for a specific Simulink object or Stateflow object. You can then use that URI as an identifier in your code to match and filter metric results for that specific object.

    If you need to convert from a digital thread URI to a Simulink or Stateflow object, use the function digitalthread.uri.simulink.toObject.

    example

    Examples

    collapse all

    Suppose you want to analyze metric results for a specific Simulink or Stateflow object.

    Create a storage map for the current project.

    storageMap = digitalthread.StorageMap.forProject();

    Find the digital thread URI by specifying the object or handle. For example, suppose you select a block in a Simulink model:

    myURI = digitalthread.uri.simulink.fromObject(storageMap,get_param(gcb,"Handle"))
    myURI = 
    
        "mwdigitalthread://myProject/myModel.slx#addr=myModel/123"

    You can use this digital thread URI in your code to find metric results that apply to this specific object.

    Input Arguments

    collapse all

    Storage map, specified as a digitalthread.StorageMap object.

    A storage map defines how digital thread URIs map to the actual artifact locations. The storage map determines which artifacts the digital thread can reference, trace, and associate with metric results.

    To create a storage map, use digitalthread.StorageMap.forProject.

    Example: digitalthread.StorageMap.forProject()

    Simulink or Stateflow object, specified as either a:

    Example: get_param(gcs,"Handle")

    Example: get_param(gcb,"Handle")

    Example: find(sfroot,"-isa","Stateflow.Chart",Path="myModel/myChart")

    Output Arguments

    collapse all

    Digital thread URI that identifies the Simulink object, returned as a string scalar.

    Use the URI as an identifier in your code to match and filter metric results for the specific object.

    Note

    Do not manually parse or construct digital thread URIs. Use the digitalthread.uri APIs to work with digital thread URIs.

    The digital thread URI format is subject to change without notice.

    Example: "mwdigitalthread://myProject/myModel.slx#addr=myModel/123:45"

    Data Types: string

    Version History

    Introduced in R2026b