remove
Syntax
Description
remove(
removes sensor data for the specified timestamps sensorDataObj
,Timestamp=timestamps
)timestamps
from the
sensor data object sensorDataObj
.
remove(
removes sensor data for the specified timestamps sensorDataObj
,Timestamp=timestamps
,TimeTol=timeTol
)timestamps
, with a
tolerance time, timeTol
, from the sensor data object
sensorDataObj
.
remove(
removes sensor data for the specified row indices sensorDataObj
,RowIndices=rowIndices
)rowIndices
from the
sensor data object sensorDataObj
.
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
Remove Data Samples from GPS Data Object
Load recorded GPS data into the workspace.
load("recordedGPSData.mat")
Initialize a GPSData
object using information from the loaded GPS data.
gpsData = scenariobuilder.GPSData(timestamps,latitudes,longitudes,altitudes)
gpsData = GPSData with properties: Name: '' NumSamples: 392 Duration: 19.5498 SampleRate: 20.0513 SampleTime: 0.0500 Timestamps: [392×1 double] Latitude: [392×1 single] Longitude: [392×1 single] Altitude: [392×1 single] Attributes: []
Plot waypoints in the GPS data object.
plot(gpsData)
Extract the timestamps for the data you want to remove from the GPS data object.
t = timestamps(1:100);
Remove the data from the GPS data object for the extracted timestamps.
remove(gpsData,Timestamp=t)
Display the GPS data object after data removal.
disp(gpsData)
GPSData with properties: Name: '' NumSamples: 292 Duration: 14.5500 SampleRate: 20.0687 SampleTime: 0.0500 Timestamps: [292×1 double] Latitude: [292×1 single] Longitude: [292×1 single] Altitude: [292×1 single] Attributes: []
Plot the GPS data object, and observe where waypoints have been removed.
figure plot(gpsData)
Specify row indices for which to remove data from the gpsData
object.
idxs = 1:100;
Remove the data from the GPS data object for the specified row indices.
remove(gpsData,RowIndices=idxs)
Display the GPS data object after data removal.
disp(gpsData)
GPSData with properties: Name: '' NumSamples: 192 Duration: 9.5493 SampleRate: 20.1063 SampleTime: 0.0500 Timestamps: [192×1 double] Latitude: [192×1 single] Longitude: [192×1 single] Altitude: [192×1 single] Attributes: []
Plot the GPS data object, and observe where waypoints have been removed.
figure plot(gpsData)
Remove Waypoints from Trajectory Object
Load recorded GPS data into the workspace.
load("recordedGPSData.mat","X","Y","Z","timestamps")
Create a Trajectory object by using the loaded timestamps and xyz-
coordinates.
traj = scenariobuilder.Trajectory(timestamps,X,Y,Z)
traj = Trajectory with properties: Name: '' NumSamples: 392 Duration: 19.5498 SampleRate: 20.0513 SampleTime: 0.0500 Timestamps: [392×1 double] Position: [392×3 double] Orientation: [392×3 double] Velocity: [392×3 double] Course: [392×1 double] GroundSpeed: [392×1 double] Acceleration: [392×3 double] AngularVelocity: [392×3 double] LocalOrigin: [0 0 0] TimeOrigin: 0 Attributes: []
Plot the trajectory object.
plot(traj)
Extract the timestamps of the data you want to remove the from the trajectory object.
t = timestamps(1:100);
Remove the data from the trajectory object for the extracted timestamps.
remove(traj,Timestamp=t)
Display the trajectory object.
disp(traj)
Trajectory with properties: Name: '' NumSamples: 292 Duration: 14.5500 SampleRate: 20.0687 SampleTime: 0.0500 Timestamps: [292×1 double] Position: [292×3 double] Orientation: [292×3 double] Velocity: [292×3 double] Course: [292×1 double] GroundSpeed: [292×1 double] Acceleration: [292×3 double] AngularVelocity: [292×3 double] LocalOrigin: [0 0 0] TimeOrigin: 0 Attributes: []
Plot the trajectory object, and observe where waypoints have been removed.
plot(traj)
Input Arguments
sensorDataObj
— Sensor data
GPSData
object | Trajectory
object | CameraData
object | LidarData
object
Sensor data, specified as a GPSData
object, Trajectory
object, CameraData
object, or a LidarData
object.
timestamps
— Timestamps for which to remove sensor data
nonnegative scalar | M-element numeric column vector | M-element datetime
array | M-element duration
array
Timestamps for which to remove sensor data, specified as a nonnegative scalar,
M-element numeric column vector, an M-element
datetime
array, or an
M-element duration
array. M is the number of timestamps. The
datatype of the timestamps
value and the datatype of the
Timestamps
property of the input sensor data object
sensorDataObj
must be the same. If you specify a positive scalar
or an M-element numeric column vector, units must be in seconds. Each
element in the timestamps
argument specifies the time at which the
GPS data was collected.
When you remove sensor data, the sensor data object
sensorDataObj
arranges the data in the increasing order of the
timestamps.
rowIndices
— Row indices of sensor data to remove
positive integer | M-element column vector of positive integers
Row indices of the sensor data to remove, specified as a positive integer or an
M-element column vector of positive integers. M
is the number of rows of the sensorDataObj
input from which to
remove data. Values must be in the range [1, NumSamples
], where
NumSamples
is the number of samples in the input sensor data object
sensorDataObj
.
Data Types: single
| double
| uint8
| uint16
| uint32
| uint64
timeTol
— Tolerance time
1e-6
(default) | nonnegative scalar
Tolerance time to read data, specified as a nonnegative scalar. Units are in
seconds. The function removes data samples for each timestamps
in
the interval, timestamps
-timeTol
to
timestamps
+ timeTol
. Increasing the
tolerance time increases the number samples in the sensor data object
sensorDataObj
.
Data Types: single
| double
Version History
Introduced in R2024b
See Also
GPSData
| Trajectory
| CameraData
| LidarData
| recordedSensorData
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 (한국어)