MATLAB: Applying Movmedian Within Cell Array

cell arraycellfunfunctionmedianmovmedian

Hello,
I have a cell array (2 x 6) called "output", each cell in row #1 {1 -> 6, 2} contains a 1024 x 1024 x 100 matrix. I want to apply movmedian to each cells in row #1. I would like to apply this function in dimension = 3 with window size = 5.
output = cellfun(@movmedian(5,3), output,'uniform', 0);
This is the code that I have come up with so far, however, it produces an "unbalenced or unexpected parenthesis or bracket" error. I am unsure what is causing this error. I am also somewhat unsure how to instruct matlab to perform this operation only on row 1 of the cell array, please help!
Thank you for your time!!

Best Answer

output(:, 1) = cellfun(@(c) movmedian(c, 5, 3), output(:, 1), 'uniform', 0);
Remember, that cellfun is very nice, but less efficient than a simply loop in general. Try this:
for k = 1:size(output, 1)
output{k, 1} = movmedian(output{k, 1}, 5, 3);
end
I prefer to keep it simple stupid, most of all if it takes less runtime in addition.