Hauptinhalt

digitalthread.uri.fromFilePath

R2026b

Get digital thread URI from file path

Since R2026b

    Description

    uri = digitalthread.uri.fromFilePath(storageMap,filePath) returns the digital thread URI for the file specified by the absolute file path filePath. The storage map, storageMap, defines how digital thread URIs map to artifact locations.

    A digital thread URI is a stable identifier for an artifact, such as a model file, 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 file. You can then use that URI as an identifier in your code to match and filter metric results for that specific file.

    Note

    The URI returned by this function identifies the file path only. You can use the URI for matching and filtering, but not as a ScopeId for execute or getMetrics. To scope metric execution or retrieval to a specific model, use the URI from digitalthread.uri.simulink.fromObject instead.

    example

    Examples

    collapse all

    Suppose you want to analyze metric results for a specific file.

    Create a storage map for the current project.

    storageMap = digitalthread.StorageMap.forProject();

    Get the absolute path to the file.

    myFilePath = which("myModel.slx")

    Find the digital thread URI for that specific file.

    myURI = digitalthread.uri.fromFilePath(storageMap,myFilePath)
    myURI = 
    
        "mwdigitalthread://myProject/myModel.slx"

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

    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()

    Absolute path to file, specified as a string scalar.

    Example: "C:\myProject\myModel.slx"

    Data Types: string

    Output Arguments

    collapse all

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

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

    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"

    Data Types: string

    Version History

    Introduced in R2026b