setdiff
Set difference of fixed.Interval
objects
Syntax
Description
returns
a C
= setdiff(A, B
)fixed.Interval
object containing the values in fixed.Interval
object A
, but not in B
.
Examples
Create two fixed.Interval
objects. Use the setdiff
function to find the values that are in Interval
object interval1
but not in interval2
. In this example, interval1
contains all values between 0 and 1, but interval2
only contains values from 0 to 0.5, so the output Interval
object has an interval from 0.5 to 1.
interval1 = fixed.Interval(0,1); interval2 = fixed.Interval(0,0.5); intervaldiff = setdiff(interval1, interval2)
intervaldiff = (0.5000,1] 1x1 fixed.Interval with properties: LeftEnd: 0.5000 RightEnd: 1 IsLeftClosed: false IsRightClosed: true
You can use the setdiff
function to create an
interval object based on another interval, while excluding zero.
Create an Interval
object that contains zero.
myInterval = fixed.Interval(-1,1);
To create an interval based on the Interval
object,
myInterval
, use the setdiff
function. Include
the constructor for a degenerate Interval
object containing only zero
as the second argument.
myInterval_nozero = setdiff(myInterval, {0});
myInterval_nozero = [-1,0) (0,1] 1x2 fixed.Interval with properties: LeftEnd RightEnd IsLeftClosed IsRightClosed
The output Interval
object, myInterval_nozero
,
contains two intervals, each with an open end point at zero. Therefore, the interval
contains all values between -1 and 1, except 0.
Input Arguments
Input fixed.Interval
objects, specified as fixed.Interval
objects, or arrays of fixed.Interval
objects.
Output Arguments
Set difference of input fixed.Interval
objects, returned as a fixed.Interval
object or an array of fixed.Interval
objects.
The output Interval
object contains all values in first input,
A
, but not in B
.
Version History
Introduced in R2019b
See Also
fixed.Interval
| contains
| intersect
| overlaps
| union
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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)