Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

datefind

Indices of dates in matrix

Syntax

  • Indices = datefind(Subset,Superset)
  • Indices = datefind(Subset,Superset,Tolerance)

Description

Indices = datefind(Subset,Superset) returns a vector of indices to the date numbers in Superset that are present in Subset. If no date numbers match, Indices = [].

Indices = datefind(Subset,Superset,Tolerance) returns a vector of indices to the date numbers in Superset that are present in Subset, plus or minus the optional argument for Tolerance. If no date numbers match, Indices = [].

Examples

collapse all

This example shows how to return a vector of indices to date numbers.

Superset = datenum(1999, 7, 1:31);
Subset = [datenum(1999, 7, 10); datenum(1999, 7, 20)];
Indices = datefind(Subset, Superset, 1)
Indices =

     9
    10
    11
    19
    20
    21

Related Examples

Input Arguments

collapse all

Subset of dates to find matching dates in Superset, specified as a matrix of nonnegative integers with values for serial date numbers or datetime arrays.

Subset and Superset can be either serial date numbers or datetime arrays. These types do not have to match. datefind determines the underlying date to match dates of different data types.

    Note:   The elements of Subset must be contained in Superset, without repetition. datefind works with non-repeating sequences of dates.

Example: Subset = [datenum(1997,7,10); datenum(1997,7,20)];

Data Types: single | double

Superset of dates, specified as a matrix of serial date numbers or datetime arrays, whose elements are sought.

Subset and Superset can be either serial date numbers or datetime arrays. These types do not have to match. datefind determines the underlying date to match dates of different data types.

    Note:   The elements of Subset must be contained in Superset, without repetition. datefind works with non-repeating sequences of dates.

Example: Superset = datenum(1997,7,1:31);

Data Types: single | double

Tolerance for matching dates (+/-) in Superset, specified as a positive integer or duration object.

Data Types: single | double

Output Arguments

collapse all

Indices of dates in Superset that are present in Subset (plus or minus the tolerance if defined using the optional argument Tolerance), returned as a vector of indices to the date numbers or datetimes.

See Also

|

Introduced before R2006a

Was this topic helpful?