How can I split time series in a half?

14 ビュー (過去 30 日間)
James James
James James 2021 年 10 月 14 日
回答済み: Walter Roberson 2021 年 10 月 14 日
The time series is consisted of 4096 samples.
I want to split it by two of 2048 samples.

採用された回答

Walter Roberson
Walter Roberson 2021 年 10 月 14 日
ts1 = timeseries(rand(1,4096));
%official approach. uses indices
ss2a = getsampleusingtime(ts1, 1, 2048);
ss2b = getsampleusingtime(ts1, 2049, 4096);
ss2a, ss2b
timeseries Common Properties: Name: 'unnamed' Time: [2048x1 double] TimeInfo: tsdata.timemetadata Data: [1x1x2048 double] DataInfo: tsdata.datametadata timeseries Common Properties: Name: 'unnamed' Time: [2047x1 double] TimeInfo: tsdata.timemetadata Data: [1x1x2047 double] DataInfo: tsdata.datametadata
%another approach. Uses times with first time being 0
ss1a = resample(ts1, 0:2047);
ss1b = resample(ts1, 2048:4095);
ss1a, ss1b
timeseries Common Properties: Name: 'unnamed' Time: [2048x1 double] TimeInfo: tsdata.timemetadata Data: [1x1x2048 double] DataInfo: tsdata.datametadata timeseries Common Properties: Name: 'unnamed' Time: [2048x1 double] TimeInfo: tsdata.timemetadata Data: [1x1x2048 double] DataInfo: tsdata.datametadata

その他の回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by