How can I select data from certain dates in a table?

Hello there! I'm pretty new to MATLAB and am struggling to find a way of efficiently "Index-Matching" some time series.
I have two sets of data:
Data 1 consists of a vector called "DryWeatherDays", which holds approximately 100 dates on which there is no rain per year. Data 2 is a table with two columns. Column one holds date and time (in 5 minute resolution, so approximately 200 entries per day), and column 2 holds flow data.
I would like to extract both column 1 and 2 from Data 2 where the date is included in Data 1, i.e. all flow data for dry weather days. Ideally, I would then get a table of data including date/time in column one and fill levels in column two. Additionally, I would like to find the minimum of each day and store it in another array DryMinimum.
I'd be thankful for any assistance with this. In excel I would use index-matching, but I would like to find a way of doing it without having to export it.

답변 (2개)

KSSV
KSSV 2017년 4월 4일

0 개 추천

You can get the dates common in two data's using ismemebr. Read baout ismemebr.
YOu can find minimum and maximum using funciton min and max.

댓글 수: 2

Unfortunately ismember doesn't work, because I have only the dates in Data1, and in Data2 I have date and time in the same column - so I get no matches.
Remove the time and convert them to datenum and use.

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

Peter Perkins
Peter Perkins 2017년 4월 6일

0 개 추천

If you have access to R2016b, this sounds exactly like what synchronize is for. You want to synchronize the second set of data to the first one by, what? summing? taking the minimum? Hard to tell form your description without a simple example.
Prior to R2016b, you can use datetimes, and the discretize function to map one set of data to the other, and probably make a call to varfun using that as the grouping variable. I think you need to post a short clear example.

카테고리

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

질문:

2017년 4월 4일

답변:

2017년 4월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by