필터 지우기
필터 지우기

Trailing string input error using rowfun

조회 수: 2 (최근 30일)
Jeff Waldron
Jeff Waldron 2016년 2월 3일
댓글: Jeff Waldron 2016년 2월 4일
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?

채택된 답변

Stephen23
Stephen23 2016년 2월 4일
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.
  댓글 수: 1
Jeff Waldron
Jeff Waldron 2016년 2월 4일
Thank you very much... I did read through, but just did not pick up on that... and when varfun worked, I stopped looking at input error...

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by