arrayfun with function with inputs of different dimensions
问题 I'm trying to create a matrix that contains the averages of the kxk submatrices of a larger nxn matrix, where n is divisible by k. I can accomplish this fairly efficiently with something like this mat = mat2cell(mat, k*ones(1,n/k), k*ones(1,n/k)) mat = cellfun(@mean,mat,'UniformOutput',false); mat = cellfun(@mean,mat,'UniformOutput',false); %repeated to collapse cells to 1x1 mat = cell2mat(mat) However, since I have a very large amount of data all in very large matrices, repeating this