Main Content

unique

Get set of unique values in fixed.Interval object

Description

uniqueinterval = unique(interval) returns a vector of incrementally sorted and non overlapping intervals that represent an equivalent value set as fixed.Interval object, interval.

example

Examples

collapse all

Use the unique function to get a non-overlapping set of intervals from an array of Interval objects.

intervals = fixed.Interval({-5,5},{-10,10},{4,20},{50,100})
    [-5,5]    [-10,10]    [4,20]    [50,100]

  1x4 fixed.Interval with properties:

              LeftEnd
             RightEnd
         IsLeftClosed
        IsRightClosed

The first three intervals represented in the object overlap with one another. The fourth interval is disjointed from the set.

uniqueInterval = unique(intervals)
uniqueInterval = 

    [-10,20]    [50,100]

  1x2 fixed.Interval with properties:

              LeftEnd
             RightEnd
         IsLeftClosed
        IsRightClosed

The output, uniqueInterval, an array of two Interval objects, merges the three overlapping intervals into a single Interval object.

Input Arguments

collapse all

Input fixed.Interval object, specified as a fixed.Interval object, or an array of fixed.Interval objects.

Output Arguments

collapse all

Non-overlapping set of Interval objects, returned as a fixed.Interval object or an array of fixed.Interval objects.

When interval is a scalar Interval object, the output is the same as the input.

Version History

Introduced in R2019b