How can I use 'rowfun' to calculate basic stats for rows in a table ?
If I try to use a function like 'sum' or 'mean' with 'rowfun' it returns an error message. For example:
>> aaa = array2table(magic(7))>> foo = rowfun(@sum, aaa)
Error using table/rowfun>dfltErrHandler (line 311)
Applying the function 'sum' to the 1st row of aaa generated the following error:
Too many input arguments.
Error in table/rowfun>@(s,varargin)dfltErrHandler(grouped,funName,s,varargin{:}) (line 195)
errHandler = @(s,varargin) dfltErrHandler(grouped,funName,s,varargin{:});
Error in table/rowfun (line 218)
[b_data{i,:}] = errHandler(struct('identifier',ME.identifier, 'message',ME.message,
'index',i),inArgs{:});
Best Answer