Not enough input argument in function
1 次查看(过去 30 天)
显示 更早的评论
Error:Not enough input arguments.
Error in myfuction (line 3) N = size(A,1);
function x=myfuction(A,N,intch)
clear flag;
N = size(A,1);
for k=1:N-1
Amax=max(A(:,k));
if(Amax==0)
set flag
intch(k)=0;
else
for m = k+1:N
if A(m,k)==Amax
intch(k)= m;
temp = A(k,:);
A(k,:) = A(m,:);
A(m,:) = temp;
end
end
for j =k+1:N
d = A(j,k)/A(k,k);
A(j,:)=A(j,:)-d*A(k,:);
end
end
end
if A(N,N)==0
set flag
intch(N)=0;
else
intch(N)=N;
end
x(n) = A(n,n+1)/A(n,n); for k = n:-1:1 x(k)=A(k,n+1); for j = k+1:n x(k)=x(k)-A(k,j)*x(j); end x(k)=x(k)/A(k,k);
end x=x'; end
9 个评论
per isakson
2017-10-8
How do call the function when you get that error?
>> x = myfuction( )
Not enough input arguments.
Error in myfuction (line 3)
N = size(A,1);
3 N = size(A,1);
回答(1 个)
Image Analyst
2017-10-8
Are you just clicking the green Run triangle without ever actually calling the function and passing variables into it like per did? That would cause an error. You MUST pass it variables!
1 个评论
per isakson
2017-10-8
编辑:per isakson
2017-10-8
+1
The error message is misleading, it could have been much more informative.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!