简体   繁体   English

matlab没有足够的输入参数错误

[英]matlab Not enough input arguments error

I am brand new to matlab. 我是Matlab的新手。 I got an error that saying " Not enough input arguments" 我收到一个错误消息,说“输入参数不足”

function ckl = cofact(A,k,l)
% Cofactor ckl of the a_kl entry of the matrix A.
[m,n] = size(A);
if m ~= n
   error('Matrix must be square')
14
end
B = A([1:k-1,k+1:n],[1:l-1,l+1:n]);
ckl = (-1)^(k+l)*det(B);

error: 错误:

>> cofact
Error using cofact (line 3)
Not enough input arguments.

in Matlab you can have functions with input and output arguments. 在Matlab中,您可以使用带有输入和输出参数的函数。 In your case you have both. 就您而言,两者都有。 The first one, "clk" is the output argument (solution). 第一个,“ clk”是输出参数(解决方案)。 And your input arguments are "A","k","l". 输入的参数是“ A”,“ k”,“ l”。 When you call your function "cofact"you need to call it by stablishing this arguments. 当您将函数称为“ cofact”时,需要通过设置此参数来调用它。 Therefore you need to define the input value to variables "A","k","l". 因此,您需要将输入值定义为变量“ A”,“ k”,“ l”。 In your case A will be the matrix and k and l the positions you want to use. 在您的情况下,A将是矩阵,而k和l是您要使用的位置。 So when you call it, will be something simillar to: 因此,当您调用它时,将类似于:

solution=cofact(MATRIX,ARG1,ARG2); 溶液= cofact(MATRIX,ARG1,ARG2);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM