arrays - Matlab: A user-defined accumulator for a matrix -
let's assume have special function this:
function [sum] = e_add(v1, v2)
and function implement this:
acc = 0; ri = 1 : size(f,1) ci = 1:size(f,2) acc = e_add(acc,f(ri,ci)); end end
is there optimized way without loop, using arrayfun
?
i'm little rusty on matlab, looking sum()? http://www.mathworks.com/help/matlab/ref/sum.html