Decimate every row in a matrix
4 views (last 30 days)
Show older comments
Hi,
I have an array 26X10600 and have successfully managed to decimate the data to the required factor, however the decimate function only applies this to the first row in the array.
Is there a way to apply the decimate function to all the rows in the array? Perhaps using a loop?
Thanks in advance,
Ed.
0 Comments
Answers (1)
Chunru
on 14 Sep 2022
% assume that decimate is used for downsampling
a = randn(100, 26); % time is along the column
[ns, nch] = size(a);
r = 5;
ns_down = floor(ns/r);
a_down = zeros(ns_down, nch);
for i=1:nch
a_down(:, i) = decimate(a(:, i), r);
end
% if you use resample
a_down = resample(a, 1, 5)
0 Comments
See Also
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!