Contenuto principale

digitalthread.uri.toRelativeFilePath

R2026b

Converts digital thread URI to relative file path

Since R2026b

    Description

    relPath = digitalthread.uri.toRelativeFilePath(uri) converts a digital thread URI to a relative file path.

    Unlike other digitalthread.uri functions, digitalthread.uri.toRelativeFilePath does not require a storageMap argument because the digital thread can find the relative path directly from the URI.

    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 relative path to the associated file by using the digitalthread.uri.toRelativeFilePath 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 relative path to the file that the digital thread URI refers to.

    myRelPath = digitalthread.uri.toRelativeFilePath(myURI)
    myRelPath = 
    
        "myModel.slx"

    Input Arguments

    collapse all

    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

    Relative path to the file that the digital thread URI refers to, returned as a string scalar.

    Example: "myModel.slx"

    Data Types: string

    Version History

    Introduced in R2026b