Main Content

readData

Read actor data from track list

Description

data = readData(trackdata,"all") reads all data from the actorTracklist object trackdata, and returns a table, data.

data = readData(trackdata,Name=Value) specifies additional options using name-value arguments. For example, 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.

example

Examples

collapse all

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}

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}

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

collapse all

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.

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 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

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

collapse all

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:

FieldDescription
TrackIDTrack 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:

  • 1 — Car

  • 2 — Truck

  • 3 — Bicycle

  • 4 — Pedestrian

  • 0 — Others

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