# Time Series analysis problems with date

조회 수: 2 (최근 30일)
mike 2021년 1월 4일
답변: Biral Pradhan 2022년 1월 25일
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!
Mike
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
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?
mike 2021년 1월 17일
Ideally to remove the lines and the gaps from the x axis so that I can them smooth and detrend.
Cheers

댓글을 달려면 로그인하십시오.

### 답변 (1개)

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.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Calendar에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by