Error with rowfun with time table as input
Show older comments
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.
Answers (1)
Peter Perkins
on 28 Mar 2018
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.
Categories
Find more on Descriptive Statistics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!