How to reduce my sample rate of data
조회 수: 15 (최근 30일)
이전 댓글 표시
Just to clarify I dont want to interpolate my data to reduce the sample, I would like to simply reduce it by picking out consecutive data. For example, I have this data variable with two columns and 14821 rows, and I would like to reduce it to 742. Now how I would imagine it is to first pick up the first row and then skip about 20 elements, then pick up the 21st row, then skip 20 elements more, and pick the 41st row and so on and on. And that way we will end up with 742 rows instead of 14821. Knowing that my variable is 14821 and I want to skip 20, I want the output to be my new variable sampled less and most importantly includes the first and last rows of the original data.
Seems like such a simple problem but for the love of pete I couldnt get it to work. Any help is appreciated.
댓글 수: 0
답변 (2개)
Star Strider
2024년 1월 24일
편집: Star Strider
2024년 1월 24일
Use a colon-operator generated vector with the necessary step.
Example —
A = [1:50; randn(1,50)].'
idx5 = 1:5:size(A,1) % 'step' = 5
A_selected = A(idx5,:)
It should be straightforward to adapt this to your problem.
.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!