How to segment/timestamp time series data based on GMT unix epoch values

1 回表示 (過去 30 日間)
Mona Elsayed
Mona Elsayed 2020 年 10 月 14 日
回答済み: Prudhvi Peddagoni 2020 年 10 月 19 日
I have an Nx2 matrix where N=size of the time series where the values in column one are GMT unix epoch microseconds and the second column are data values such as voltage from an ECG sensor
For example:
Time (microseconds) Data (mv)
1) 1.58187589357166e+15 0.0149830624856947
2) 1.58187589357565e+15 0.0226207624424608
3) 1.58187589357965e+15 0.0127982248671193
4) 1.58187589358365e+15 0.00203405305053278
...
Is there a way I can segment the data (column 2) based on start and stop time values?
Say I want a numeric matrix of the data between 2) 1.58187589357565e+15 and 4) 1.58187589358365e+15, how would I create that (without necissarily knowing the indices since these are really large time series and it is difficult to manually search for the corresponding time values)?
I would use the sampling frequency to manually segment the data but I just learned from the manufacturer that this is not an accurate technique for my data

回答 (1 件)

Prudhvi Peddagoni
Prudhvi Peddagoni 2020 年 10 月 19 日
Hi,
let
A= [ 1 10;
2 20;
3 30;
4 40;]
if you want to select data values(2nd column) for time which lies between 1 and 4 in the first column, you can do this:
index1= A(:,1)>1; %gives indexes of all time values with value greater than 1
index2=A(:,1)<4; %gives indexes of all time values with value less than 4
index=index1 & index2 % gives indexes off all time values that lie between 1 and 4
values=A(index, 2) % gives the required data values
% or you can do this in a single line like this
values= A(A(:,1)>1 & A(:,1)<4,2);
you can find more information here.
Hope this helps.

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by