필터 지우기
필터 지우기

out = x; "Not enough input arguments"

조회 수: 1 (최근 30일)
Geir
Geir 2013년 9월 12일
Script:
function out = g(x)
%g(x) er en funksjon med delt forskrift
out = x;
n = length (x);
for k=1:n
if (x(k)<0)
out = -x(k).^2;
else
out = sin(4.*x);
end
end
end
Problem:
I get this message:
EDU>> g
Error using g (line 3)
Not enough input arguments.
How do I solve this?

답변 (1개)

Laurent
Laurent 2013년 9월 12일
편집: Laurent 2013년 9월 12일
How did you call your function? It seems you forgot to put input arguments, in this case 'x'.
I would try to call your function from the command window as follows (I took 5 as an example here):
result=g(5);
Do you still get the error?
  댓글 수: 1
Geir
Geir 2013년 9월 12일
Excellent, thank you!

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

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by