Main Content

contains

Determine if one fixed.Interval object contains another

Description

bool = contains(A, B) returns a boolean indicating whether fixed.Interval object A contains the fixed.Interval object B.

example

Examples

collapse all

Create two fixed.Interval objects. Use the contains function to determine if the intervals in interval2 are contained within the corresponding intervals in interval1.

interval1 = fixed.Interval({0,1}, {2,3}, {3,4});
interval2 = fixed.Interval({0,0.5}, {2.5, 3}, {4,5});
bool = contains(interval1, interval2)
bool = 1x3 logical array

   1   1   0

When the second input is a scalar Interval object, contains determines whether each interval of the first input contains the interval of the second input.

interval2 = fixed.Interval(0,1);
bool = contains(interval1, interval2)
bool = 1x3 logical array

   1   0   0

Input Arguments

collapse all

Input fixed.Interval objects, specified as fixed.Interval objects, or arrays of fixed.Interval objects.

If A is an array of Interval objects, B must be a scalar Interval object or an Interval object with the same dimensions as A.

Output Arguments

collapse all

Whether fixed.Interval object B is contained in fixed.Interval object A, returned as a logical value.

When A is an array of Interval objects, the output is an array of logical values of the same size as A.

Version History

Introduced in R2019b