readData
Read actor data from track list
Description
reads all data from the data
= readData(trackdata
,"all")actorTracklist
object trackdata
, and returns a table,
data
.
specifies additional options using name-value arguments. For example,
data
= readData(trackdata
,Name=Value
)TrackIDs="4"
reads all data with track ID 4 from the input actorTracklist
object trackdata
.
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
Read Data From Actor Track List Object Using Row Indices
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
Initialize an actorTracklist
object by using the extracted data.
actorTrackData = actorTracklist(t,trackids,classids,pos);
Specify row indices for which to read data from the actorTracklist
object.
idxs = (1:10)';
Read data for the specified row indices.
tab = readData(actorTrackData,RowIndices=idxs);
Display the first eight rows of the table containing actor track information.
head(tab)
TimeStamp ActorInfo _________ ____________ 0.000383 {3x1 struct} 0.050654 {3x1 struct} 0.10058 {3x1 struct} 0.1504 {3x1 struct} 0.20034 {3x1 struct} 0.25059 {3x1 struct} 0.30035 {3x1 struct} 0.35015 {3x1 struct}
Read Data From Actor Track List Object Using Timestamps
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
Initialize an actorTracklist
object by using the extracted data.
actorTrackData = actorTracklist(t,trackids,classids,pos);
Specify the timestamps for which to read data from the actorTracklist
object.
ts = t(1:3);
Read data for the specified timestamps.
tab = readData(actorTrackData,Timestamps=ts);
Display the data.
disp(tab)
TimeStamp ActorInfo _________ ____________ 0.000383 {3x1 struct} 0.050654 {3x1 struct} 0.10058 {3x1 struct}
Read Data From Actor Track List Object Using Track IDs
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
Initialize an actorTracklist
object by using the extracted data.
actorTrackData = actorTracklist(t,trackids,classids,pos);
Specify a track ID for which to read data from the actorTracklist
object.
tid = "4";
Read data for the specified track ID.
tab = readData(actorTrackData,TrackIDs=tid);
Display the first eight rows of the table containing actor track information.
head(tab)
TimeStamp ActorInfo _________ ____________ 0.000383 {1x1 struct} 0.050654 {1x1 struct} 0.10058 {1x1 struct} 0.1504 {1x1 struct} 0.20034 {1x1 struct} 0.25059 {1x1 struct} 0.30035 {1x1 struct} 0.35015 {1x1 struct}
Input Arguments
trackdata
— Actor track list information
actorTracklist
object
Actor track list information, specified as an actorTracklist
object.
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: readData(trackdata,TrackIDs="4")
reads the data with track ID
4 from the input actorTracklist
object trackdata
.
RowIndices
— Row indices for which to read track information
N-element column vector
Row indices for which to read track information, specified as an
N-element column vector of positive integers.
N is the number of row indices of the input
trackdata
from which to read data. Values must be in the range
[1, NumSamples
], where NumSamples
is the value
of the NumSamples property of the input trackdata
.
Data Types: single
| double
| uint8
| uint16
| uint32
| uint64
Timestamps
— Timestamps for which to read track information
N-element column vector
Timestamps for which to read track information, specified as an
N-element column vector. N is the number of
timestamps of the input trackdata
from which to read data. Units
are in seconds.
Data Types: single
| double
TrackIDs
— Track IDs of actors for which to read track information
N-by-1 string array
Track IDs of the actors for which to read track information, specified as an
N-by-1 string array. N is the number of track
IDs for which to read data from the input trackdata
.
Data Types: char
| string
Output Arguments
data
— Actor track list data
K-by-2 table
Actor track list data, returned as a K-by-2 table.
K is the number of actor track list samples. The table contains two
columns specifying timestamps TimeStamp
and actor information
ActorInfo
. Each row in the table represents track information
relative to its recording time.
Each element of the first column of the table contains the timestamp at which the corresponding track information was captured, returned as a positive scalar. Units are in seconds.
Each element of the second column of the table contains the track information of non-ego actors, returned as an M-by-1 structure array. M is the number of actors with track information recorded at the corresponding timestamp. Each structure has these fields:
Field | Description |
---|---|
TrackID | Track ID of the actor, returned as a numeric scalar, a string scalar, or a character vector. |
ClassID | Classification identifier of the actor, returned as one of these nonnegative integers:
|
Position | Position of the actor with respect to the ego frame, returned as a three-element numeric row vector of the form [x y z]. Units are in meters. |
Dimension | Dimensions of the actor, returned as a three-element numeric row vector of the form [length width height]. Units are in meters. |
Yaw | Yaw angle of the actor with respect to the ego frame, returned as a numeric scalar. Units are in degrees. |
Pitch | Pitch angle of the actor with respect to the ego frame, returned as a numeric scalar. Units are in degrees. |
Roll | Roll angle of the actor with respect to the ego frame, returned as a numeric scalar. Units are in degrees. |
Speed | Speed of the actor with respect to the ego frame, returned as a numeric scalar. Units are in meters per second. |
Velocity | Velocity of the actor with respect to the ego frame, returned as a three-element numeric row vector of the form [vx vy vz]. Units are in meters per second. |
Data Types: table
Version History
Introduced in R2013a
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 (한국어)