Main Content

getPropertyValues

Get property values of block and block finder result objects

    Description

    example

    propVals = getPropertyValues(resultObject,propNames) returns the values of the properties specified in propNames for the block finder result object, resultObject. propNames must have the names of the properties of the finder result object or the block represented by the finder result object.

    Examples

    collapse all

    Find the property values of the Inport blocks in the slrgex_sf_car model.

    Import the required packages to avoid using long, fully qualified class names.

    import slreportgen.finder.*

    Load the model and search for all of the Inport blocks in the model. For each result object, print the DiagramPath property.

    model_name = 'slrgex_sf_car';
    load_system(model_name)
    
    
    diagFinder = SystemDiagramFinder(model_name);
    diagFinder.IncludeRoot = false;
    while hasNext(diagFinder)
        diagram = next(diagFinder);
        ioFinder = BlockFinder(diagram.Object);
        ioFinder.BlockTypes = "Inport";
        blocks = find(ioFinder);
        for block = blocks
            getPropertyValues(block,"DiagramPath")
        end  
    end
    

    Input Arguments

    collapse all

    Finder result object, specified as an slreportgen.finder.BlockResult object.

    List of property values to access, specified as an string array or cell array of characters.

    Valid propNames elements are:

    If propNames contains invalid properties, the corresponding cell array value is N/A.

    Output Arguments

    collapse all

    Values of the accessed properties, returned as a cell array.

    Version History

    Introduced in R2022a