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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- 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)