Filtering one array in a 1x4 cell
Show older comments
I got a 1x4 cell containing 4 different trials. In each trial, the first array is a counter (from an encoder) and doesn't need filtering while the other array is forces which needs to be filtered. How do i access the second array of each trial in the cell, filter it, while keeping the data in a cell structure?

Answers (1)
Guillaume
on 30 Nov 2016
I assume by 1st and 2nd array, you actually mean column.
One possibility:
filtered_psn = cellfun(@(m) [m(:, 1), yourfilteringfunction(m(:, 2))], Psn, 'UniformOutput', false);
Or use a loop:
filtered_psn = psn;
for psnidx = 1 : numel(psn)
filtered_psn{psnidx}(:, 2) = yourfilteringfunction(filtered_psn{psnidx}(:, 2));
end
Categories
Find more on Discontinuities 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!