Main Content

addData

Add lane information to lane data object

Since R2023a

Description

addData(lanedata,timestamps,lbdata) adds the specified lane information lbdata to the laneData object lanedata.

example

addData(___,Name=Value) specifies options using name-value arguments in addition to the arguments from the previous syntax. For example, TrackIDs=trackIDs adds the track IDs of lane boundaries trackIDs to the laneData object.

Note

This function requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install the Scenario Builder for Automated Driving Toolbox support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

Examples

collapse all

Create an empty laneData object.

ld = laneData
ld = 
  laneData with properties:

           TimeStamp: []
    LaneBoundaryData: []
     LaneInformation: []
            TrackIDs: []
           StartTime: []
             EndTime: []
          NumSamples: 0

Load recorded lane boundary data into the workspace.

data = load("laneBoundaryData.mat");

Extract the recorded timestamps and the lane boundary information from the data.

t = data.timestamps;    % Extract timestamps
lbdata = data.lbdata;   % Extract lane boundary information

Add the first five rows of lane information to the laneData object.

addData(ld,t(1:5),lbdata(1:5,:))

Display the details of the laneData object.

disp(ld)
  laneData with properties:

           TimeStamp: [5x1 double]
    LaneBoundaryData: {5x1 cell}
     LaneInformation: []
            TrackIDs: []
           StartTime: 0
             EndTime: 0.2000
          NumSamples: 5

Input Arguments

collapse all

Recorded lane data, specified as a laneData object.

Timestamps of lane information to add, specified as an N-element numeric column vector. N is the number of timestamps. Units are in seconds.

When you add lane data, the laneData object automatically arranges timestamps in increasing order. If the input data contains multiple rows of data with the same timestamp, the object merges that data into a single row.

Data Types: double

Lane boundary data to add, specified as an N-by-M matrix or N-by-1 cell array. N is the number of timestamps.

If you have an equal number of recorded lane boundaries across all timestamps, specify lbdata as an N-by-M array of parabolicLaneBoundary objects, cubicLaneBoundary objects, or clothoidLaneBoundary objects. M is the uniform number of detected lane boundaries for each sample.

If you have an unequal number of recorded lane boundaries across timestamps, specify lbdata as an N-by-1 cell array. Each cell entry must contain an M-element row vector of parabolicLaneBoundary objects, cubicLaneBoundary objects, or clothoidLaneBoundary objects. M is the number of detected lane boundaries at the timestamp.

The movements of the ego vehicle and non-ego actors must follow the vehicle coordinate system used by Automated Driving Toolbox. For more information on the vehicle coordinate system, see Vehicle Coordinate System.

Note

You must specify all lane boundaries using the same type of 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: addData(lanedata,timestamps,lbdata,TrackIDs=trackIDs) adds track IDs of lane boundaries trackIDs to the laneData object.

Lane information, specified as an N-by-M structure array. N is the number of timestamps. M is the greatest number of lane boundaries detected at any specified timestamp.

Track IDs of the lane boundaries, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the track IDs of the lane boundaries detected at the corresponding timestamp, specified as a 1-by-M string array. M is the number of actors at a timestamp.

Version History

Introduced in R2023a

expand all