Error with rowfun with time table as input

Im trying to calculate mean for each row of a timetable.
Count.AvgDCInputKW = rowfun(@mean,temp1,'OutputVariableNames','AverageDataPoints');
temp1 being a timetable here.
however, I am getting the following error. Im not sure what the problem is. I tried calculating mean for Row1 to check if there are any problems with the data but it runs just fine. I can run a loop to calculate mean for each row but I rather use rowfun if possible.

回答(1 个)

mean is a function that takes one (data) input, and I imagine your timetable has more than one variable. I suspect you need to look at this parameter:
'SeparateInputs' - Specifies whether FUN expects separate inputs, or one
vector containing all inputs. When true (the default),
rowfun calls FUN with one argument for each data variable.
When false, rowfun creates the input vector to FUN by
concatenating the values in each row of A, and the data
variables in A must be compatible for that concatenation.

类别

帮助中心File Exchange 中查找有关 Descriptive Statistics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by