Main Content

getAttribute

Return static attribute of actor

    Description

    example

    a = getAttribute(actor,'attribute') returns the value of the specified static attribute for the Simulink.ActorModel object actor.

    Examples

    collapse all

    Create ss, a Simulink.ScenarioSimulation object.

    rrApp = roadrunner('C:\Project\TestHighwayRoute'); 
    openScenario(rrApp,'myScenario1'); 
    ss = createSimulation(rrApp); 

    Start the simulation.

    set(ss, 'SimulationCommand','Start')
    

    Pause the simulation.

    set(ss, 'SimulationCommand','Pause')
    

    Get all actors in the simulation.

    actorsAll = get(ss,'ActorSimulation')

    Get the static specifications of the first actor.

    actormodel = get(actorsAll(1),'ActorModel')

    Get the paint color of the first actor.

    pc = getAttribute(actormodel, 'PaintColor')

    Input Arguments

    collapse all

    Actor from which to return static attribute, specified as a Simulink.ActorModel object.

    Example: pc = getAttribute(actor, 'BoundingBox')

    Static attribute of actor, specified as one of these values.

    ParameterDescription
    IDActor identifier, returned as a positive integer
    NameActor name, returned as a string
    PaintColorColor of the actor
    BoundingBoxBounding box of the actor
    WheelSpecWheel specifications of vehicle-type actor

    Example: pc = getAttribute(actormodel, 'PaintColor')

    Output Arguments

    collapse all

    Value of static attribute of actor, returned as one of these data types.

    ParameterOutput Data Type
    IDuint64
    Namechar
    PaintColorstruct
    BoundingBoxstruct
    WheelSpecstruct

    This table describes the fields of the PaintColor struct.

    Field NameDescription
    rRed color, returned as a uint32 value.
    gGreen color, returned as a uint32 value.
    bBlue color, returned as a uint32 value.
    aTransparency of the color (alpha), returned as a uint32 value.

    This table describes the fields of the BoundingBox struct.

    Field NameDescription
    MinThe bounding box corner with minimal x-, y- and z- values, returned as a 1-by-3 array.
    MaxThe bounding box corner with maximal x-, y- and z- values, returned as a 1-by-3 array.

    This table describes the fields of the WheelSpec struct.

    Field NameDescription
    AxleIndexAxle index of a wheel. The front-most axle has the starting index value of zero, with index values increasing towards the vehicle rear. Returned as a uint32 value.
    WheelOffsetx-, y- and z- coordinates of the wheel center, in the vehicle coordinate system. Returned as a 1-by-3 vector.
    WheelRadiusRadius of the wheel in meters. Returned as a double.

    Version History

    Introduced in R2022a