Line plot for irregular timeseries data
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone i am new to matlab.
First i convert into datetime format.
1.my question is how to plot line graphs for irregular timeseries data.
2.How to set datetick format in x-axis.
i attached my excel file and code which i tried also.
some sample plot also i added
.
I hope i will get answer for this thank you advance
Plot(book.date,book.Nnuc)
datetick('x','dd-MM-yyyy HH:mm:ss','keepticks');
댓글 수: 0
채택된 답변
Chunru
2021년 12월 6일
편집: Chunru
2021년 12월 9일
a = readtable("book.xlsx");
idx = find(diff(a.date) > 1.2/24); % find the location of large time gap
a.Nnuc(idx+1) = nan; % use nan to remove the part
plot(a.date, a.Nnuc)
datetick('x');
댓글 수: 8
Chunru
2021년 12월 9일
Your current data has 1h interval except for some gap. The statement above 1.2/24 is to find the gap greater than 1.2h (datetime has a unit of 'day' so we need the division by 24).
If your normal time interval is 15 min and you expect a gap is larger than 15 min, you can cahnge 1.2/24 into 1.2*(15/60)/24 where 15/60/24 is to conversion from min to day. A factor of 1.2 is to check if the gap is 1.2*15min=18min.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!