Matlab 错误';输入参数过多';兴高采烈
为什么这个匿名函数不能与Matlab 错误';输入参数过多';兴高采烈,matlab,Matlab,为什么这个匿名函数不能与rowfun一起使用 >> T = table([43;52;67;28],[64;24;69;45]) >> rowfun(@(x) sum(x), T) Error using tabular/rowfun>dfltErrHandler (line 497) Applying the function '@(x)sum(x)' to the 1st row of A generated the following error: Too
rowfun
一起使用
>> T = table([43;52;67;28],[64;24;69;45])
>> rowfun(@(x) sum(x), T)
Error using tabular/rowfun>dfltErrHandler (line 497)
Applying the function '@(x)sum(x)' to the 1st row of A generated the following
error:
Too many input arguments.
这里要执行的操作是,而不是,匿名函数应该有两个输入,即
rowfun(@(x,y) plus(x,y), T)
这也相当于:
rowfun(@plus, T)
输出:
ans =
4×1 table
Var1
____
107
76
136
73
这里要执行的操作是,而不是,匿名函数应该有两个输入,即
rowfun(@(x,y) plus(x,y), T)
这也相当于:
rowfun(@plus, T)
输出:
ans =
4×1 table
Var1
____
107
76
136
73
你真的确定
rowfun(@sum,T)
是你想要得到的结果吗?@Sardar Usama,你是对的,不是,我编辑了我的问题。你真的确定rowfun(@sum,T)
是你想要得到的结果吗?@Sardar Usama,你是对的,不是,我编辑了我的问题。