Time Series analysis problems with date
5 views (last 30 days)
Show older comments
Hi all-and a happy new year (lets hope its better than the last one......)
My query concerns time series.
I have a dataset which consists of 7 seperate excel files, first column is date and second column is a scalar number.
The date is a period of 8 months, jan-aug for 10 years (repeated in each excel file).
I have plotted the first file and the first 8 months plot fine for the ten year period, however, the sep-dec period is also plotted which shows no data, therefore there is a straight line until the next year starts on the graph.
I have used the code
= datevec(cam{:,1}); and also tried
= datenum (cam{:,1});
both do not work!!
So my question is how do I plot the data for just the dates shown which Jan 1st-Aug 31st 2010-2020?
Im fairly new to all this, I have tried using the mathworks help section and tried several other pieces of code, but I get the dreaded red writing, I apologise if this is a billy basic question!
many thanks in advance
Mike
4 Comments
Adam Danz
on 17 Jan 2021
Is the goal to remove the straight line from the data while maintaining the sept-dec dates along the x axis? Or is the goal to remove the gap completly and jump from Aug to Jan along the x axis?
Answers (1)
Biral Pradhan
on 25 Jan 2022
I understand, you want to remove the straight line as well as x-axis labels corresponding to those 4 months (Sep-Dec) for each year. I assume, you plan on interpolating the data for these 4 months later. While plotting monthly data using datetime values from different tables (as in your case), the axis spacing is determined uniformly, so you get labels separated by 1 calendar month.
I do not think it is possible to abruptly change the spacing from 1 calender month to 4 abruptly. A workaround would be to use a timetable and resample your data.
0 Comments
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!