Main Content

updateTime

Update timestamps of lane data object

Since R2023a

Description

updateTime(lanedata,timestamps) updates the timestamps of the laneData object with the specified timestamps timestamps.

example

updateTime(lanedata,fhandle) updates the timestamps of the laneData object with the specified function fhandle.

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 an initialized laneData object into the workspace.

data = load("laneDataObject.mat");
ld = data.ld;

Display the first few timestamps of the laneData object.

head(ld.TimeStamp)
         0
    0.0499
    0.0994
    0.1503
    0.2000
    0.2497
    0.3004
    0.3501

Extract the recorded timestamps from the laneData object.

t = ld.TimeStamp;

Offset each timestamp by 10 seconds.

t = t + 10;

Update the timestamps of the laneData object.

updateTime(ld,t);

Display the first few updated timestamps of the laneData object.

head(ld.TimeStamp)
   10.0000
   10.0499
   10.0994
   10.1503
   10.2000
   10.2497
   10.3004
   10.3501

Load an initialized laneData object into the workspace.

data = load("laneDataObject.mat");
ld = data.ld;

Display the first few timestamps of the laneData object.

head(ld.TimeStamp)
         0
    0.0499
    0.0994
    0.1503
    0.2000
    0.2497
    0.3004
    0.3501

Update the timestamps of the laneData object with a linear offset of 10 seconds by specifying a function handle.

updateTime(ld,@(t)t+10);

Display the first few updated timestamps of the laneData object.

head(ld.TimeStamp)
   10.0000
   10.0499
   10.0994
   10.1503
   10.2000
   10.2497
   10.3004
   10.3501

Input Arguments

collapse all

Recorded lane data, specified as a laneData object.

Timestamps with which to update lane information, specified as an N-element nonnegative vector. N must be the same as the value of the NumSamples property of the input laneData object lanedata. The input timestamps must be in increasing order. Units are in seconds.

Data Types: single | double

Timestamp update function, specified as a function handle. The updateTime function applies fhandle to every element of the TimeStamp property of the laneData object. fhandle must have this function syntax:

timeout = newTime(timein),
where timein is the timestamps from the TimeStamp property, specified as an N-element nonnegative column vector, and timeout is the updated timestamps.

Version History

Introduced in R2023a