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.

Respuestas (2)

KSSV
KSSV el 4 de Abr. de 2017
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 comentarios

Nina Hain
Nina Hain el 4 de Abr. de 2017
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.
KSSV
KSSV el 4 de Abr. de 2017
Remove the time and convert them to datenum and use.

Iniciar sesión para comentar.

Peter Perkins
Peter Perkins el 6 de Abr. de 2017
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.

Categorías

Etiquetas

Preguntada:

el 4 de Abr. de 2017

Respondida:

el 6 de Abr. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by