I have a function that takes in any number of arguments into a cell array
function sumThese(varargin)
subtotals = cellfun(@sum, varargin);
total = sum(subtotals);
disp(total)
end
This works for arrays and numbers, except as soon as I have a square matrix it doesn't. It'll tell me:
Non-scalar in Uniform output, set 'UniformOutput' to false.
However if I set 'uniformoutput'
to false
, I get this error now:
Undefined function or method 'sum' for input arguments of type 'cell
How to approach this?