addData
Description
addData(
adds the specified track ID data trackdata
,timestamps
,trackID
,classID
,position
)trackID
, class ID data
classID
, and position data position
with the
corresponding timestamps timestamps
to the actorTracklist
object trackdata
.
addData(___,
specifies
additional options using name-value arguments, in addition to all input arguments from the
previous syntax. For example, Name=Value
)Velocity={[4 1 0; 2 2 1]}
adds velocities
of the form [vx
vy
vz] for two actors at one timestamp.
Note
This function requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install Scenario Builder for Automated Driving Toolbox from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.
Examples
Create Empty Actor Track List Object and Add Data
Create an empty actorTracklist
object.
actorObject = actorTracklist
actorObject = actorTracklist with properties: TimeStamp: [] TrackIDs: [] ClassIDs: [] Position: [] Dimension: [] Orientation: [] Velocity: [] Speed: [] StartTime: [] EndTime: [] NumSamples: 0 UniqueTrackIDs: []
Load recorded actor track list data into the workspace.
data = load("actorTracklistData.mat");
Extract the recorded timestamps and the actor track IDs, class IDs, and position information from the data.
t = data.timestamps; % Extract timestamps trackids = data.actorTrackIDs; % Extract track IDs classids = data.actorClassIDs; % Extract class IDs pos = data.actorPosition; % Extract position information
Add the first five rows of data to the empty actorTracklist
object.
addData(actorObject,t(1:5),trackids(1:5),classids(1:5),pos(1:5))
Display the details of the actorTracklist
object.
disp(actorObject)
actorTracklist with properties: TimeStamp: [5x1 double] TrackIDs: {5x1 cell} ClassIDs: {5x1 cell} Position: {5x1 cell} Dimension: [] Orientation: [] Velocity: [] Speed: [] StartTime: 3.8300e-04 EndTime: 0.2003 NumSamples: 5 UniqueTrackIDs: [3x1 string]
Input Arguments
trackdata
— Actor track list information
actorTracklist
object
Actor track list information, specified as an actorTracklist
object.
timestamps
— Recording timestamps of track information to add
scalar | N-by-1 vector
Recording timestamps of track information to add, specified as a scalar or an N-element column vector. N is the number of timestamps. Units are in seconds.
Data Types: single
| double
trackID
— Track IDs of actors
N-by-1 string array | N-by-1 cell array
Track IDs of the actors, specified as an N-by-1 string array or an N-by-1 cell array. N is the number of timestamps for which you are adding information.
For a single recorded actor across each timestamp, specify
trackID
as an N-by-1 string array.
For a multiple recorded actors across each timestamp, specify
trackID
as an N-by-1 cell array. Each cell
contains the track IDs of the actors to add at the corresponding timestamp, specified as
a 1-by-M string array. M is the number of actors
at the timestamp.
classID
— Classification IDs of actors
N-element column vector | N-by-1 cell array
Classification IDs of the actors, specified as an N-element column vector or an N-by-1 cell array. N is the number of timestamps for which you are adding information.
For a single recorded actor across each timestamp, specify
classID
as an N-by-1 vector.
For a multiple recorded actors across each timestamp, specify
classID
as an N-by-1 cell array. Each cell
contains the class IDs of the detected actors to add at the corresponding timestamp,
specified as an M-element row vector of nonnegative integers.
M is the number of actors at the timestamp.
You must specify each class ID as one of these nonnegative integers:
1
— Car2
— Truck3
— Bicycle4
— Pedestrian0
— Others
position
— Positions of actors
N-by-1 cell array
Positions of actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. 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.
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: addData(trackdata,timestamps,trackID,classID,position,Velocity={[4 1 0;
2 2 1]})
adds velocities of the form [vx
vy
vz] for two actors at one timestamp.
Dimension
— Dimensions of the actors
N-by-1 cell array
Dimensions of the actors, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. 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 dimension of an actor in the form [length width height]. Units are in meters.
Orientation
— Orientations of the actors
N-by-1 cell array
Orientations of the actors, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. 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.
Speed
— Speeds of actors
N-by-1 cell array
Speeds of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. 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.
Velocity
— Velocities of actors
N-by-1 cell array
Velocities of the actors with respect to the ego frame, specified as an N-by-1 cell array. N is the number of timestamps for which you are adding information. 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 a timestamp. Each row specifies the velocity of an actor in the form [vx vy vz]. Units are in meters per second.
Version History
Introduced in R2023a
See Also
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)