Main Content

readData

Read lane boundary data from laneData object

Since R2023a

Description

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

data = readData(lanedata,Timestamps=timestamps) reads data from the laneData object for the timestamps timestamps you specify.

data = readData(lanedata,RowIndices=rowIndices) reads data from the laneData object for the row indices rowIndices you specify.

example

data = readData(___,SortLanes=sortLanes) specifies whether to sort the lanes in the output table data.

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

Load recorded lane boundary data into the workspace.

data = load("laneBoundaryData.mat");

Extract the recorded timestamps and the lane boundaries from the data.

t = data.timestamps;    % Extract timestamps
lbdata = data.lbdata;   % Extract lane boundaries

Initialize a laneData object by using the extracted data.

ld = laneData(t,lbdata);

Specify row indices for which to read data from the laneData object.

idxs = 1:10;

Read data for the specified row indices.

tab = readData(ld,RowIndices=idxs);

Display the table containing the first 10 rows of lane information.

disp(tab)
    TimeStamp           LaneBoundary1                  LaneBoundary2       
    _________    ___________________________    ___________________________

           0     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}
    0.049887     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}
    0.099382     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}
     0.15034     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}
     0.19999     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}
     0.24967     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}
     0.30038     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}
     0.35012     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}
     0.40052     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}
     0.44945     {1×1 parabolicLaneBoundary}    {1×1 parabolicLaneBoundary}

Input Arguments

collapse all

Recorded lane data, specified as a laneData object.

Row indices for which to read lane information, specified as an N-element vector of positive integers. N is the number of rows of the lanedata input from which to read. Values must be in the range [1, NumSamples], where NumSamples is the value of the NumSamples property of the input laneData object lanedata.

Data Types: single | double | uint8 | uint16 | uint32 | uint64

Timestamps for which to read lane information, specified as a scalar or an N-element vector. N is the number of timestamps for which to read data from the input lanedata. Units are in seconds. The data in the output table retains the order you specify to this argument.

Data Types: single | double

Sort lanes flag, specified as a logical 1 (true) or 0 (false). Specify 1 to sort the lane boundaries in the output table data. Otherwise, specify 0. If you specify 1, the function sorts the lane boundaries in left-to-right order, with respect to the travel direction of the ego vehicle.

Output Arguments

collapse all

Lane detection data, returned as an M-by-P table. M is the number of lane-detection samples, and (P–1) is the greatest number of detected lane boundaries across all samples. This table shows an example of the data organization.

TimeStampLaneBoundary1LaneBoundary2LaneBoundary3
01x1 parabolicLaneBoundary1x1 parabolicLaneBoundary1x1 parabolicLaneBoundary
0.051x1 parabolicLaneBoundary1x1 parabolicLaneBoundary[]
0.11x1 parabolicLaneBoundary1x1 parabolicLaneBoundary1x1 parabolicLaneBoundary

  • The first column of the table is the recorded timestamp, in seconds, for each detection in the corresponding row. All other columns contain data for the detected lane boundaries as parabolicLaneBoundary objects, cubicLaneBoundary objects, or clothoidLaneBoundary objects. All lane boundaries in the table are of the same object type.

  • Empty cells represent missing lane boundary detections.

  • If lane information is present in input laneData object, then readData object function also includes lane information data in the output table data.

  • The detected lane boundaries are in left-to-right order with respect to the travel direction of the ego vehicle.

  • If you specify values in the timestamps argument that do not correspond to timestamps present in the laneData object, the function returns NaN for every column in the corresponding row of the output table data.

Data Types: table

Version History

Introduced in R2023a

expand all