Filtering one array in a 1x4 cell
显示 更早的评论
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?

回答(1 个)
Guillaume
2016-11-30
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
类别
在 帮助中心 和 File Exchange 中查找有关 Discontinuities 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!