How to separate time series data?

9 次查看(过去 30 天)
Paul
Paul 2023-3-2
For context, I have 15 seconds worth of data although I only want to analyse the data from 12 seconds to 15 seconds. How do i seperate the final 3 seconds from my time series data?
TIA :)

回答(1 个)

Star Strider
Star Strider 2023-3-2
It depends how they are formatted.
Assuming the times are a datetime array —
t = datetime(1,1,1) + seconds(0:0.5:15).';
s = randn(size(t));
T1 = table(t,s) % Data Table
T1 = 31×2 table
t s ____________________ _________ 01-Jan-0001 00:00:00 -0.10358 01-Jan-0001 00:00:00 -0.73795 01-Jan-0001 00:00:01 -0.046795 01-Jan-0001 00:00:01 0.0031687 01-Jan-0001 00:00:02 -0.73363 01-Jan-0001 00:00:02 1.5337 01-Jan-0001 00:00:03 1.3429 01-Jan-0001 00:00:03 -0.22569 01-Jan-0001 00:00:04 -0.35433 01-Jan-0001 00:00:04 -0.72689 01-Jan-0001 00:00:05 -2.0043 01-Jan-0001 00:00:05 0.51185 01-Jan-0001 00:00:06 -0.26662 01-Jan-0001 00:00:06 0.76956 01-Jan-0001 00:00:07 1.9912 01-Jan-0001 00:00:07 0.31162
Lv = second(T1{:,1}) >= 12; % Logical Vector
T1e = T1(Lv,:) % Result
T1e = 7×2 table
t s ____________________ _______ 01-Jan-0001 00:00:12 0.2435 01-Jan-0001 00:00:12 0.65176 01-Jan-0001 00:00:13 0.37124 01-Jan-0001 00:00:13 1.0221 01-Jan-0001 00:00:14 -1.8486 01-Jan-0001 00:00:14 -0.5345 01-Jan-0001 00:00:15 0.18867
.

社区

更多回答在  Power Electronics Control

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by