Main Content

findElementByPath

Find elements by path in AF server

Since R2026a

    Description

    afElements = findElementByPath(afclientObj,elementPath) finds elements in the AF server at the locations in the database hierarchy specified by elementPath.

    Note

    You must install the AF SDK library to connect to a PI AF server from MATLAB®. For more information, see AF SDK Overview.

    example

    Examples

    collapse all

    Create an AF client. The client is associated with the default database of the PI AF server.

    afclientObj = afclient("EVS-Hydroplant");

    Change the connection to a database that includes the required elements.

    selectDatabase(afclientObj,"OSIDemo_PG_HydroPlant");

    Find elements on the AF server using specified paths. Each path describes a hierarchy of elements in the database leading to the desired element.

    paths = ["\\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU1\GU1 Generator", ...
        "\\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU2\GU2 Generator"];
    guElements = findElementByPath(afclientObj,paths)
    guElements = 
    
      1×2 Element array:
        Index      Name                                            Path                                           NumChildren
        -----  -------------  ----------------------------------------------------------------------------------  -----------
          1    GU1 Generator  \\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU1\GU1 Generator       0
          2    GU2 Generator  \\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU2\GU2 Generator       0

    Input Arguments

    collapse all

    AF client, specified as an icomm.af.Client object created using the afclient function.

    Path of an AF element in an AF database, specified as a string, character vector, or string array. The path describes a hierarchy of elements in the database.

    Data Types: char | string

    Output Arguments

    collapse all

    AF element, returned as an icomm.af.Element object or array of icomm.af.Element objects. For more information, see AF Element Properties.

    Version History

    Introduced in R2026a