remove
Syntax
Description
Add-On Required: This feature requires the Scenario Builder for Automated Driving Toolbox add-on.
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.
Examples
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)

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
Sensor data, specified as a GPSData
object, Trajectory
object, CameraData
object, or a LidarData
object.
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.
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
Tolerance time for removing data, specified as a nonnegative scalar. Units are in
seconds. For each element of timestamps, i, the
function removes data samples with timestamps in the range [i –
timeTol, i + timeTol].
Increasing the tolerance time can increase the number of samples removed from 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.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)