フィルターのクリア

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 Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by