Line plot for irregular timeseries data

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');

 採用された回答

Chunru
Chunru 2021 年 12 月 6 日
編集済み: Chunru 2021 年 12 月 9 日

0 投票

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 件のコメント

vignesh mohan
vignesh mohan 2021 年 12 月 9 日
chunru sir thank you but i want to remove the empty line how can i remove that?
Chunru
Chunru 2021 年 12 月 9 日
What empty line? Do you mean the flat part from ~4/15-4/16?
vignesh mohan
vignesh mohan 2021 年 12 月 9 日
yea chunru sir. i want to remove flat part from that particular date 4/15,4/16
Chunru
Chunru 2021 年 12 月 9 日
See above on removing the flat part.
vignesh mohan
vignesh mohan 2021 年 12 月 9 日
Thank you so much chunru sir It works fine and onething i want to know is if i want to plot for Nsatk means again i want to run this code a.Nnuc(idx+1) = nan; for Nsatk?isn't?
vignesh mohan
vignesh mohan 2021 年 12 月 9 日
If i have a 15 min time intervel means what can i do for that sir?
idx = find(diff(a.date) > 1.2/24) can i add 15min instead of 24?
Chunru
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.
vignesh mohan
vignesh mohan 2021 年 12 月 9 日
Thank you so much sir

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by