"Not enough input arguments" error

When I test this code which is shown below. I got an error of " not enough input arguements". How can i solve this error?
Error:--

4 件のコメント

Arif Hoq
Arif Hoq 2023 年 1 月 30 日
編集済み: Arif Hoq 2023 年 1 月 30 日
please check your input arguments. the input arguments in the function and also in the main script should be same.
for example:
x=10;
y=12;
z=20;
out=mynewfunc(x,y,z)
out = 6
function out=mynewfunc(x,y,z)
out=x*y/z;
end
Arif Hoq
Arif Hoq 2023 年 1 月 30 日
編集済み: Arif Hoq 2023 年 1 月 30 日
same error: absence of input argument x in the main script. Also make sure you initialized all the input in your main script.
x=10;
y=12;
z=20;
out=mynewfunc(y,z)
Not enough input arguments.

Error in solution>mynewfunc (line 7)
out=x*y/z;
function out=mynewfunc(x,y,z)
out=x*y/z;
end
Dyuman Joshi
Dyuman Joshi 2023 年 1 月 30 日
In order to run a function with inputs, it is necessary to give inputs.
Shreyas
Shreyas 2023 年 1 月 30 日
Hello Bidyarani,
You will need to pass the necessary inputs and capture the outputs to run function "admiss_control" as:
[ out_1, out_2, ..] = admiss_control( inp_1, inp_2, inp_3, ..)
in the Command Window.

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

 採用された回答

Tushar Behera
Tushar Behera 2023 年 1 月 30 日

0 投票

Hi Bidyarani,
I understand that you are getting the "not enough input arguments" error while executing the above code.
The "Not enough input arguments" error in MATLAB occurs when a function is called with fewer input arguments than it is defined to accept. To solve this error, you need to provide the required number of input arguments to the function.
I would suggest starting a debugging session and checking whether all the input arguments such as "new_N", "n_intfs" etc. are getting initialized before line 11 or not. This can be done by setting up break points before line 11 and checking out the variables present in the workspace at that instance.
For further knowledge on how to debug your code using MATLAB, you can use the following link:
I hope this solves your query.
Regards,
Tushar

その他の回答 (1 件)

Sandile Maduna
Sandile Maduna 2025 年 3 月 19 日

0 投票

please help in clearing this error:
Not enough input arguments.
Error in cell (line 32)
eta_act = (R * T / (alpha * n * F)) * log(max(j / i0, 1e-6)); % Avoid log(0)
^
Error in matlab.ddux.internal.logData
Error in sltemplate.internal.utils.logDDUX
Error in sltemplate.ui.StartPage/showWithFallback
Error in sltemplate.ui.StartPage.show

1 件のコメント

Adam Danz
Adam Danz 2025 年 3 月 20 日
We would need reproduction steps, something we can copy-paste into MATLAB that will produce this error, and we would need to know your MATLAB release.

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

カテゴリ

製品

リリース

R2020a

質問済み:

2023 年 1 月 30 日

コメント済み:

2025 年 3 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by