I would like to select data from a date range using month end. I have a bunch of month end dates in datetime and numeric values for each of those. I want to be able to extract the values by inputting a date range. For example, return all numeric values for 1/31/2012 to 12/31/15. Then I would take the standard deviation of that 3 year history.

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2015년 6월 15일

0 개 추천

d=datenum('1/31/2010'):datenum('12/31/15') % Example
data=randi(9,numel(d),1)'
d1=datenum('1/31/2012')
d2=datenum('12/31/2015')
idx=d>d1& d<d2
out=[d(idx); data(idx)]'

댓글 수: 1

Harry Lindner
Harry Lindner 2015년 6월 15일
편집: Harry Lindner 2015년 6월 15일
Hi, Thank you for the reply. I only have month end values, so this index exceeds the matrix dimensions.
I attached a sample file to the original question.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Dates and Time에 대해 자세히 알아보기

질문:

2015년 6월 15일

편집:

2015년 6월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by