Trying to break time series data up by season
2 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Agnish Dutta
on 10 Apr 2019
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:
See Also
Categories
Find more on Dates and Time 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!