主要内容

digitalthread.uri.toAbsoluteFilePath

R2026b

Converts digital thread URI to absolute file path

Since R2026b

    Description

    filePath = digitalthread.uri.toAbsoluteFilePath(storageMap,uri) converts a digital thread URI to an absolute file path.

    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 retrieve the file that a digital thread URI refers to. You can then work directly with that file.

    You might already have a digital thread URI of interest from your metric results. If not, you can get the digital thread URI from a specific file by using the other functions in the digitalthread.uri namespace, such as digitalthread.uri.fromFilePath.

    example

    Examples

    collapse all

    Suppose you have a digital thread URI that appears in your metric results. You can get the absolute path to the associated file by using the digitalthread.uri.toAbsoluteFilePath function.

    For example, suppose the ScopeId property for one of your metric results shows a digital thread URI mwdigitalthread://myProject/myModel.slx" and you save that URI to a variable.

    myURI = "mwdigitalthread://myProject/myModel.slx";

    Get the absolute path to the file that the digital thread URI refers to.

    myAbsPath = digitalthread.uri.toAbsoluteFilePath(storageMap,myURI)
    myAbsPath = 
    
        "C:\myProject\myModel.slx"

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

    Digital thread URI, specified as a string scalar.

    You can get digital thread URIs from metric results and other functions in the digitalthread.uri namespace, such as digitalthread.uri.fromFilePath.

    Example: "mwdigitalthread://myProject/myModel.slx"

    Data Types: string

    Output Arguments

    collapse all

    Absolute path to file, returned as a string scalar.

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

    Data Types: string

    Version History

    Introduced in R2026b