How to reduce my sample rate of data
17 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Star Strider
on 24 Jan 2024
Edited: Star Strider
on 24 Jan 2024
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 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!