how to use datefind function?

2 次查看(过去 30 天)
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.

采纳的回答

Titus Edelhofer
Titus Edelhofer 2016-2-16
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Financial Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by