MATLAB input function error; Output arguments.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Zane Gomes
el 28 de Mzo. de 2021
Comentada: Zane Gomes
el 28 de Mzo. de 2021
The line of code is of the form:
line 23>Var_1 = input('prompt\n');
The error message is,
>Output argument "SA" (and maybe others) not assigned during call to "input".
>Error in %filename% (line 23)
If I'm not wrong, I have assigned a value to the output argument during the call to input, that being Var_1, right?
Could someone explain what might be the problem?
Exact code:
student_id_number = input('Enter students ID number:');
corresponding error message:
Output argument "SA" (and maybe others) not assigned during call to "input".
Error in lab4t5 (line 23)
student_id_number = input('Enter students ID number:');
2 comentarios
per isakson
el 28 de Mzo. de 2021
I cannot reproduce the error you see (Win10/R2018b)
>> student_id_number = input('Enter students ID number:');
Enter students ID number:12345
>> student_id_number
student_id_number =
12345
The variable, SA, what's that?
Respuesta aceptada
Stephen23
el 28 de Mzo. de 2021
Editada: Stephen23
el 28 de Mzo. de 2021
You have created/added a function with name input, which shadows the inbuilt input function.
Use which to find the location of your input function/s:
which input -all
Delete or rename your input function/s. In future, do NOT name functions with the same name as inbuilt functions.
3 comentarios
Stephen23
el 28 de Mzo. de 2021
Editada: Stephen23
el 28 de Mzo. de 2021
"But dosen't the user created functions need to be located in the same directory to be able to be called in an m file?"
No.
In order to be called from anywhere, functions must be on the MATLAB Search Path (or in the current directory). They are processed in the order that they are found on the Search Path:
In some very specific cases (e.g. private functions) there are further restrictions on where a function can be called from (but nothing like only "in the same directory" that I can recall).
Please remember to accept my answer if it resolves your original question.
Más respuestas (0)
Ver también
Categorías
Más información sobre File Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!