Hi I have a few sets of data with corresponding dates and there could be several data associated with the same date. I would like to extract my data 50 days prior to a set date (eg: 01 May 1998), and also extract the corresponding data. Copying and Pasting the same code 50 times seems very tedious. Is there a way to loop through the dates and extract the daily data? Please help!

댓글 수: 1

Jas K
Jas K 2016년 11월 3일
What I have now is to find the index of the dates and extract the corresponding data using the index. However, I'd need to do this multiple times, if I want to do it for all 50 days.

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

 채택된 답변

Image Analyst
Image Analyst 2016년 11월 3일

0 개 추천

There are tons of date time functions. Have you looked at them. For example addtodate() might be useful to you.
oldDate = addtodate(currentDate, -50, 'day'); % Subtract 50 days from the current date.
and datediff() and lots of others. Give it a try.

추가 답변 (0개)

카테고리

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

질문:

2016년 11월 3일

댓글:

2016년 11월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by