not enough input arguments

function b = rq_fnm(X, y, p)
[m n] = size(X);
u = ones(m, 1);
a = (1 - p) .* u;
b = -lp_fnm(X', -y', X' * a, u, a)';
when running this code i am getting the following error. please do help
rq_fnm
Not enough input arguments.
Error in rq_fnm (line 2)
[m n] = size(X);

1 件のコメント

Shalu Mathew
Shalu Mathew 2020 年 2 月 24 日
i am having an error at the second line of this code.

サインインしてコメントする。

回答 (2 件)

madhan ravi
madhan ravi 2020 年 2 月 24 日

0 投票

1 件のコメント

Shalu Mathew
Shalu Mathew 2020 年 2 月 24 日
"Not enough input arguments." why is this error coming up?

サインインしてコメントする。

Steven Lord
Steven Lord 2020 年 2 月 24 日

0 投票

You've defined your function to accept up to three input arguments.
function b = rq_fnm(X, y, p)
On the first line of your function you use the first of those arguments, so you must pass at least the first of those input arguments into it. On the third and fourth lines you use the third and second input arguments, so you must pass those inputs into the function as well.
How did you call it? It looks like you call it something like:
b = rq_fnm
You didn't give it a value for X, so when rq_fnm tries to use X it gets confused. That's why MATLAB threw the error. It would be like someone telling you to go to the store to get three things, then not telling you what to get. You'd probably ask "So what do you want me to get?" MATLAB is a little less patient, though, so it complains "You didn't tell me what to get!" rather than asking.

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

タグ

質問済み:

2020 年 2 月 24 日

回答済み:

2020 年 2 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by