How to split time series array into subarrays according to sampling rate?

Hi, I have a data acquired from ECG sensor sampled at 128 sps I want to make subarrays each contains 256 sample?

답변 (1개)

Krithika A
Krithika A 2018년 7월 24일
편집: Krithika A 2018년 7월 24일
sps = 128;
n = 768; % 128*6 = 768, so a 6s long signal with 128 sps
x = randn(1,n);
y = reshape(x, [], sps*2);

댓글 수: 9

Phoenix98
Phoenix98 2018년 7월 24일
편집: Phoenix98 2018년 7월 24일
Hi, Thanks for your answer,I tested it and it works but ECG data is corrupt when it splitted
Can you give me specifics of the corruption? Like a plot of the corrupt data?
More specifically, reshape will never change any of the data in the matrix/vector it reshapes. So if the data is corrupt, it is because it was corrupt to start with.
So indeed, you need to be more specific about that corruption.
Hi,
This is the plot of the first 256 samples before reshaping
and This is after reshaping
The problem is most likely with the way you plot your data (which you haven't shown). If you plot a matrix, you should get more than one plot.
Hi, I have 12800 samples array, and I split them into 256 sample subarrays, so I have a matrix of 50 subarrays I plot only the first array in the matrix.
Hi, I Test reshape(x,[],50) and it works well instead of reshape(x,[],256)
It should be indeed
reshape(x, [], 50)
to divide the data into 50 columns or even better:
reshape(x, 256, [])
to split the data into columns of 256 elements. In each case, each subarray ends up as a column.
Yes, Guillaume is 100% correct.
Glad you sorted it out.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2018년 7월 24일

댓글:

2018년 7월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by