This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

removeInvalidData

Remove invalid range and angle data

Syntax

validScan = removeInvalidData(scan)
validScan = removeInvalidData(scan,Name,Value)

Description

validScan = removeInvalidData(scan)returns a new lidarScan object with all Inf and NaN values from the input scan removed. The corresponding angle readings are also removed.

example

validScan = removeInvalidData(scan,Name,Value)provides additional options specified by one or more Name,Value pairs.

Examples

collapse all

Specify lidar data as vectors of ranges and angles. These values include readings outside of the sensors range.

x = linspace(-2,2);
ranges = abs((1.5).*x.^2 + 5);
ranges(45:55) = 3.5;
angles = linspace(-pi/2,pi/2,numel(ranges));

Create a lidar scan by specifying the ranges and angles. Plot all points of the lidar scan.

scan = lidarScan(ranges,angles);
plot(scan)

Remove invalid points based on a specified minimum and maximum range.

minRange = 0.1;
maxRange = 7;
scan2 = removeInvalidData(scan,'RangeLimits',[minRange maxRange]);
hold on
plot(scan2)
legend('All Points','Valid Points')

Input Arguments

collapse all

Lidar scan readings, specified as a lidarScan object.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: ["RangeLimits",[0.05 2]

Range reading limits, specified as a two-element vector, [minRange maxRange], in meters. All range readings and corresponding angles outside these range limits are removed

Data Types: single | double

Angle limits, specified as a two-element vector, [minAngle maxAngle] in radians. All angles and corresponding range readings outside these angle limitslimits are removed.

Angles are measured counter-clockwise around the positivez-axis.

Data Types: single | double

Output Arguments

collapse all

Lidar scan readings, specified as a lidarScan object. All invalid lidar scan readings are removed.

Introduced in R2017b