# convertToStruct

Convert actor to MATLAB structure

Since R2022a

## Syntax

``actorStruct = convertToStruct(actorSim)``

## Description

example

````actorStruct = convertToStruct(actorSim)` converts the `ActorSimulation` actor specified by `actorSim` to its equivalent MATLAB® structure.```

## Examples

collapse all

Create `sim`, a `ScenarioSimulation` object.

```rrApp = roadrunner("C:\Project\TestHighwayRoute"); openScenario(rrApp,"myScenario1"); sim = createSimulation(rrApp);```

Start the simulation.

`set(sim,"SimulationCommand","Start");`

Pause the simulation.

`set(sim,"SimulationCommand","Pause");`

Retrieve one actor from the simulation.

```actorsim = get(sim,"ActorSimulation"); actorOne = actorsim(1); ```

Convert the actor to a MATLAB structure.

`actorStruct = convertToStruct(actorOne)`
```actorStruct = struct with fields: ActorID: 1 Pose: [4×4 double] Velocity: [0 0 0] AngularVelocity: [0 0 0]```

## Input Arguments

collapse all

Actor, specified as an `ActorSimulation` object.

## Output Arguments

collapse all

MATLAB structure equivalent to actor, returned as a `struct`. This MATLAB structure contains the runtime attributes of the specified actor.

The returned structure contains these fields.

FieldDescription
`ActorID`Actor identifier, returned as a positive integer.
`Pose`Position and orientation of actor in the RoadRunner Scenario coordinate system, returned as a 4-by-4 array.
`Velocity`Velocity of actor in the x-, y-and z- directions, returned as a 1-by-3 vector. Units are in meters per second.
`AngularVelocity`Angular velocity of actor in the x-, y-and z- directions, returned as a 1-by-3 real-valued vector. Units are in radians per second.

## Version History

Introduced in R2022a