主要内容

getAttributes

Get attributes of AF element by name

Since R2026a

    Description

    afAttributes = getAttributes(elementObj) returns all attributes of the AF element specified by elementObj.

    afAttributes = getAttributes(elementObj,attributeName) returns a filtered list of attributes matching the name specified by attributeName. This function supports wildcard search when you use an asterisk * anywhere in attributeName.

    If there are no matches, afAttributes 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 associated with the default database of the server and find an element in the database.

    afclientObj = afclient("EVS-Hydroplant");
    guElement = findElementByName(afclientObj,"GU2 Turbine");

    Retrieve attributes using wildcard search.

    attributes = getAttributes(guElement,"Current*")
    attributes = 
    
      1×3 Attribute array:
        Index       Name                                                    Path                                                  ServerDataType
        -----  ---------------  ------------------------------------------------------------------------------------------------  --------------
          1    Current Phase A  \\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU2\GU2 Turbine|Current Phase A      Double
          2    Current Phase B  \\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU2\GU2 Turbine|Current Phase B      Double
          3    Current Phase C  \\EVS-HydroPlant\OSIDemo_PG_HydroPlant\Flynn River Hydro\Flynn I\GU2\GU2 Turbine|Current Phase C      Double

    Input Arguments

    collapse all

    AF element, specified as an icomm.af.Element object. You can use findElementByName, findElementByPath, or findElementByTemplate to create an icomm.af.Element object or array of AF element objects.

    Name of AF attribute, specified as a string or character vector. For wildcard search, use asterisk * anywhere in the attribute name.

    Example: getAttributes(guElement,"Current Phase A") returns attributes whose name exactly matches the specified name.

    Example: getAttributes(guElement,"Current*") returns attributes whose name starts with the specified name.

    Example: getAttributes(guElement,"*wind*") returns attributes containing the specified substring wind anywhere in their name.

    Data Types: char | string

    Output Arguments

    collapse all

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

    Version History

    Introduced in R2026a