How to separate time series data?

8 views (last 30 days)
Paul
Paul on 2 Mar 2023
Answered: Star Strider on 2 Mar 2023
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 :)

Answers (1)

Star Strider
Star Strider on 2 Mar 2023
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
.

Communities

More Answers in the  Power Electronics Control

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!