주요 콘텐츠

findElementByName

Find element by name in AF database

Since R2026a

    Description

    afElements = findElementByName(afclientObj,elementName) finds elements in the AF database whose names match the specified name. This function supports wildcard search when you use an asterisk * anywhere in the elementName.

    If there are no matches, afElements is empty.

    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 in the AF server using AF element names.

    targetNames = ["GU1 Generator","GU2 Turbine"];
    guElements = findElementByName(afclientObj,targetNames)
    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 Turbine      \\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU2\GU2 Turbine          0

    Input Arguments

    collapse all

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

    Name of an AF element in the connected AF database, specified as a string, character vector, string array, or cell array of character vectors. For wildcard search, use asterisk * anywhere in the element name.

    Example: findElementByName(afclientObj,"GU1 Generator") returns elements whose name exactly matches the specified name.

    Example: findElementByName(afclientObj,"Generator*") returns elements whose name starts with the specified name.

    Example: findElementByName(afclientObj,"*hydro*") returns elements containing the specified substring hydro anywhere in their name.

    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