Why do I get the error"Not enough input arguments."

when I press the "Run" button,it shows: >> qqqq Not enough input arguments.
Error in qqqq (line 13) t0=t-t1;

Answers (2)

KSSV
KSSV on 19 Sep 2016
Edited: KSSV on 19 Sep 2016
is a function which needs input t...So when you are running it it is demanding t. But on looking at the script t is already defined inside. So comment the line function [lambda, phi] = qqqq(t) (first line), run it as a script not a a function. Note that you have to remove end when you run it as a script.
Or simply change
function [lambda, phi] = qqqq(t)
to
function [lambda, phi] = qqqq()

5 Comments

when I change to 'function[lamda,phi]=qqqq()',it shows the error 'Undefined function or variable 't'.
Error in qqqq (line 13) t0=t-t1;'
KSSV
KSSV on 19 Sep 2016
Edited: KSSV on 19 Sep 2016
Ohh....Yes....the line t0 = t-t1 demands the value of 't'...then you have no other option then inputting value of 't'.
could u please tell me how to solve it ?
You input some t ..it will run..but I cannot promise the result unless it is known what for code is meant.
well,whatever,thx a lot~

Sign in to comment.

You appear to have a mixture of a script and a function in the same file. Unless you're using the just released R2016b, this is not going to work.
On R2016a, or earlier, move the script (from the start of the for loop) in its own file and run it from there.
On R2016b, move the script before the function and terminate the function with the end keyword.

Asked:

on 19 Sep 2016

Commented:

on 19 Sep 2016

Community Treasure Hunt

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

Start Hunting!