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

Respuestas (2)

KSSV
KSSV el 19 de Sept. de 2016
Editada: KSSV el 19 de Sept. de 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 comentarios

hengheng zhang
hengheng zhang el 19 de Sept. de 2016
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 el 19 de Sept. de 2016
Editada: KSSV el 19 de Sept. de 2016
Ohh....Yes....the line t0 = t-t1 demands the value of 't'...then you have no other option then inputting value of 't'.
hengheng zhang
hengheng zhang el 19 de Sept. de 2016
could u please tell me how to solve it ?
KSSV
KSSV el 19 de Sept. de 2016
You input some t ..it will run..but I cannot promise the result unless it is known what for code is meant.
hengheng zhang
hengheng zhang el 19 de Sept. de 2016
well,whatever,thx a lot~

Iniciar sesión para comentar.

Guillaume
Guillaume el 19 de Sept. de 2016

0 votos

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.

Preguntada:

el 19 de Sept. de 2016

Comentada:

el 19 de Sept. de 2016

Community Treasure Hunt

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

Start Hunting!

Translated by