add
Description
Add-On Required: This feature requires the Scenario Builder for Automated Driving Toolbox add-on.
add(
adds the specified actor track data trackData,timestamps,trackID,position)trackID and
position, with their corresponding timestamps
timestamps, to the actor track data object
trackData.
add(___, specifies
options using one or more name-value arguments in addition to the input arguments from the
previous syntax. For example, Name=Value)Attributes=attributes adds the optional
actor track attributes attributes to the actor track data
object.
Examples
Load recorded actor track data into the workspace.
load("trackedActorData.mat")Initialize an ActorTrackData object using the information from the loaded actor track data.
idx = 100; timestamps = trackedActorData.Timestamps; trackID = trackedActorData.TrackID; position = trackedActorData.Position; trackData = scenariobuilder.ActorTrackData(timestamps(1:idx),trackID(1:idx),position(1:idx))
trackData =
ActorTrackData with properties:
Name: ''
NumSamples: 100
Duration: 4.9491
SampleRate: 20.2058
SampleTime: 0.0500
Timestamps: [100×1 double]
TrackID: {100×1 cell}
Category: []
Position: {100×1 cell}
Dimension: []
Orientation: []
Velocity: []
Speed: []
Age: []
Attributes: []
UniqueTrackIDs: [6×1 string]
UniqueCategories: []
Play the actor track data object.
play(trackData)

Add additional data samples to the actor track data object.
add(trackData,timestamps(idx+1:end),trackID(idx+1:end),position(idx+1:end))
Play the actor track data object, and observe the added actor tracks.
play(trackData)

Input Arguments
Actor track data, specified as an ActorTrackData object.
Timestamps of actor track information, specified as an N-element
numeric column vector, an N-element datetime array, or an N-element duration array. N is the number of timestamps. Each
element in the timestamps argument specifies the time at which the
corresponding actor track information was collected. If you specify an
N-element numeric column vector, units must be in seconds.
The add function arranges the added actor track data by their
timestamps, in increasing order.
Track IDs of the actors, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the track IDs of the actors detected at the corresponding timestamp, specified as an M-by-1 string array. M is the number of actors at the timestamp.
Data Types: cell
Positions of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the positions of the actors detected at the corresponding timestamp, specified as an M-by-3 numeric matrix. M is the number of actors at the timestamp. Each row specifies the position of an actor in the form [x y z]. Units are in meters.
Data Types: cell
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: add(trackData,timestamps,trackID,position,Age=age) adds track
data with the ages of the actor tracks age.
Name of the recorded actor track data, specified as a string scalar or character vector.
Data Types: char | string
Category names of the actors, such as car, truck, bicycle, and pedestrian, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the category names of the actors detected at the corresponding timestamp, specified as an M-by-1 string array. M is the number of actors at the timestamp.
Data Types: cell
Dimensions of the actors, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the dimensions of the actors detected at the corresponding timestamp, specified as an M-by-3 numeric matrix. M is the number of actors at the timestamp. Each row specifies the dimensions of an actor in the form [length width height]. Units are in meters.
Data Types: cell
Orientations of the actors, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the orientations of the actors detected at the corresponding timestamp, specified as an M-by-3 numeric matrix. M is the number of actors at the timestamp. Each row specifies the orientation of an actor in the form [yaw pitch roll]. Units are in degrees.
Data Types: cell
Speeds of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the speeds of the actors detected at the corresponding timestamp, specified as an M-element numeric row vector. M is the number of actors at the timestamp. Units are in meters per second.
Data Types: cell
Ages of the actor tracks, specified as an N-by-1 cell array. The age of a track is the number of times it has been updated. N is the number of timestamps. Each cell contains the ages of the actor tracks at the corresponding timestamp, specified as an M-element row vector of positive integers. M is the number of actors at the timestamp.
Data Types: cell
Velocities of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the velocities of the actors detected at the corresponding timestamp, specified as an M-by-3 numeric matrix. M is the number of actors at the timestamp. Each row specifies the velocity of an actor in the form [vx vy vz]. Units are in meters per second.
Data Types: cell
Optional actor track attributes, specified as an N-by-1 array. N is the number of timestamps. Each element in the array contains the additional actor track attributes, such as acceleration values, recorded at the corresponding timestamp.
Version History
Introduced in R2025a
See Also
remove | read | plot | play | filter | mergeTrackIDs | mapTrackIDsToNumbers | importFromObjectTrack | GPSData | Trajectory | CameraData | LidarData | recordedSensorData
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)