Main Content

padv.util.getSubsystemPath

Get path of subsystem or block diagram for artifact

    Description

    blockPath = padv.util.getSubsystemPath(Artifact=artifactObject) gets the block path of the specified artifact. If the artifact is not a subsystem or block diagram, the function returns an empty string.

    example

    Examples

    collapse all

    To get the block path of a subsystem represented by a padv.Artifact object, use the utility function padv.util.getSubsystemPath. You can use the subsystem block path to reconfigure the behavior of the padv.builtin.query.FindSubsystemsForModel query. This example shows how to get the path at the MATLAB® command line, but you can also use this function inside your process model.

    Open a project. For this example, open the Process Advisor example project.

    processAdvisorExampleStart

    Create an instance of the FindSubsystemsForModel query.

    q = padv.builtin.query.FindSubsystemsForModel();

    Find the padv.Artifact object for the AHRS_Voter model by creating and running an instance of the FindModels query.

    parentQuery = padv.builtin.query.FindModels(IncludePath="AHRS_Voter");
    AHRSmodel = parentQuery.run();

    Run the FindSubsystemsForModel query using AHRSmodel as the iteration artifact. The query returns the five subsystems associated with the AHRS_Voter model.

    subsystems = q.run(AHRSmodel)
    subsystems = 
    
      1×5 Artifact array with properties:
    
        Type
        Parent
        ArtifactAddress
        Alias

    for i = 1:length(subsystems)
        padv.util.getSubsystemPath(Artifact=subsystems(i))
    end
    ans =
    
        'AHRS_Voter'
    
    
    ans =
    
        'AHRS_Voter/MidValue'
    
    
    ans =
    
        'AHRS_Voter/OneValue'
    
    
    ans =
    
        'AHRS_Voter/ZeroValue'
    
    
    ans =
    
        'AHRS_Voter/AvgValue'

    You can filter out specific subsystems by using the subsystem block path to specify query properties like IncludePath and ExcludePath. For example, this code excludes the MidValue subsystem with the block path AHRS_Voter/MidValue by specifying the ExcludePath property of the query and reruns the query to get the query results which no longer include the MidValue subsystem.

    q.ExcludePath = "AHRS_Voter/MidValue";
    subsystems = q.run(AHRSmodel);
    subsystems.Alias
    ans = 
    
        "AHRS_Voter"
    
    
    ans = 
    
        "OneValue"
    
    
    ans = 
    
        "ZeroValue"
    
    
    ans = 
    
        "AvgValue"

    Input Arguments

    collapse all

    Artifact, specified as a padv.Artifact object.

    For more information, see padv.Artifact.

    Example: padv.Artifact("artifact_type","artifact_address")

    Output Arguments

    collapse all

    Path to block, returned as a character vector.