How can I select data from certain dates in a table?
Show older comments
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.
Answers (2)
Peter Perkins
on 6 Apr 2017
0 votes
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.
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!