Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 错误';输入参数过多';兴高采烈_Matlab - Fatal编程技术网

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,你是对的,不是,我编辑了我的问题。