Trailing string input error using rowfun
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jeff Waldron
am 3 Feb. 2016
Kommentiert: Jeff Waldron
am 4 Feb. 2016
when I try to apply the @sum function to my table via rowfun(@sum,table), I get the following:
Error using sum Trailing string input must be 'double', 'native', 'default', 'omitnan' or 'includenan'.
yet I get NO error when I execute varfun(@sum,table).... Anyone have any ideas?
0 Kommentare
Akzeptierte Antwort
Stephen23
am 4 Feb. 2016
The problem is that you are supplying multiple inputs to sum, but sum only accepts one array input (the other inputs are optional control arguments).
The documentation for rowfun states that it supplies the row as separate inputs to the function, not as one variable: "func accepts size(A,2) inputs."
The solution is to read the rowfun documentation, and set the optional argument 'SeparateInputs' to false.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!