Trying to break time series data up by season

3 次查看(过去 30 天)
I've got a 24 column csv file I am read and parse out 8 columns of interest and a timestamp (I can't riddle out how to get the timestamps to not come in as NAN so I use readmatrix and then pre-process a unix timestamp into a spare column) with this I end up making a timeTable in matlab as I convert the unix time stamp back to something matlab understands once it's in.
I have 30 years of data and a few plots (PDF, CDF, and boxplot) that I want to make for the whole data set as well as every fall, winter, summer, etc. The plots for the whole data set are a breeze with the statistics toolbox. so the question is - how do I create subsets of my data that are only certain seasons?
for a single year I could do something crude like this
spring = timeSeries(timeSeries.ts > '20-March-1980 12:00:00', :); % parse data before start date of spring
spring = spring(spring.ts < '21-June-1980 12:00:00', :); %parse data after stop date of spring
This doesnt readily scale to all 30 years of data. If I should not use time tables or something that's fine, I'm just using what I've seen in forums.

回答(1 个)

Agnish Dutta
Agnish Dutta 2019-4-10
The "getsampleusingtime(tsin,starttime,endtime)" function could be used to create subsets of time series data. You can specify the 'starttime' and 'endtime' parameters corresponding to those of fall and spring, to effectively split the time series as required.
Refer to the following document for more information:
  1 个评论
Justin Bell
Justin Bell 2020-5-20
That seems to suffer from the same issue of, it works between 2 date ranges, but can't iterate that span over several years. Unless I have missed something obvious in the documentation

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Timetables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by