フィルターのクリア

Count number business days per month

3 ビュー (過去 30 日間)
Ana
Ana 2014 年 4 月 26 日
編集済み: Azzi Abdelmalek 2014 年 4 月 26 日
19630102
19630103
19630104
19630107
19630108
19630109
19630110
19630111
19630114
19630115
19630116
19630117
19630118
19630121
19630122
19630123
19630124
19630125
19630128
19630129
19630130
19630131
19630201
19630204
19630205
19630206
19630207
19630208
19630211
19630212
19630213
19630214
19630215
19630218
19630219
19630220
19630221
19630225
19630226
19630227
19630228
Good evening,
I have a set of data like the one shown in the figure below (but the complete set of data goes until 2013), which represent already the business days in that month.
I would want a column that counts the number of days per month and gives me, for instance, 22 in row 1 (for January), 19 in row 2 (for February) and so on.
Thank you!!
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 4 月 26 日
編集済み: Azzi Abdelmalek 2014 年 4 月 26 日
date is numeric or char? and instead of posting an image, copy and past your data,in away we could use it
Ana
Ana 2014 年 4 月 26 日
Numeric!

サインインしてコメントする。

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 4 月 26 日
編集済み: Azzi Abdelmalek 2014 年 4 月 26 日
n=max(0,fix(log10(data)+1)-6)
b=fix(data./10.^n)
c=unique(b);
f=histc(b,c);
q=uint8(rem(c/100,1)*100);
p=arrayfun(@(x) datestr(datenum(num2str(x),'mm'),'mmm'),q,'un',0);
out=[p num2cell(f)]
  1 件のコメント
Ana
Ana 2014 年 4 月 26 日
I am getting a "??? Index exceeds matrix dimensions." error.
Is there a reason why this appears? The data I am testing the code in right now has 62 rows, from beggining of January 1963 to end of March 1963.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by