how to use datefind function?

3 visualizzazioni (ultimi 30 giorni)
pruth
pruth il 16 Feb 2016
Risposto: Titus Edelhofer il 16 Feb 2016
in help, I found this
Superset = datenum(1999, 7, 1:31);
Subset = [datenum(1999, 7, 10); datenum(1999, 7, 20)];
Indices = datefind(Subset, Superset, 5)
Indices =
5
6
7
8
9
10
11
12
13
14
15
15
16
17
18
19
20
21
22
23
24
25
here tolerance = (Optional) Tolerance (+/-) for matching the date numbers in Superset. but what to do if I want only previous dates. i.e.
5
6
7
8
9
10
15
16
17
18
19
20
only negative tolerance.

Risposta accettata

Titus Edelhofer
Titus Edelhofer il 16 Feb 2016
Hi,
use
which datefind
to find the file datefind.m in the finance toolbox. Copy it to your folder and name it "mydatefind.m". Open in the editor and replace the line
i = find(d <= tol);
by
i = find(d <= tol & super<=sub(idx));
Hope this helps,
Titus

Più risposte (0)

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by