I keep getting undefined input error

2 visualizaciones (últimos 30 días)
rak crak
rak crak el 10 de Mayo de 2022
Editada: Cris LaPierre el 10 de Mayo de 2022
Hello , im trying to make this gpa/cgpa calculator that asks the user for input , but whenever i reach the the input that requires a character it shows undifined error as shown in the screenshot :
Enter letter grade for course: A
Error using input
Undefined function or variable 'A'.
Error in Untitled11 (line 10)
Grade = input('Enter letter grade for course: ');

Respuestas (1)

Mathieu NOE
Mathieu NOE el 10 de Mayo de 2022
hello
you want to request a string not a number , so the correct code is :
Grade = input('Enter letter grade for course: ',"s");
  4 comentarios
rak crak
rak crak el 10 de Mayo de 2022
i use R2018a , will check help of the function , thank you.
Cris LaPierre
Cris LaPierre el 10 de Mayo de 2022
Editada: Cris LaPierre el 10 de Mayo de 2022
Try using single quotes for 's', similar to what you did for Course.
Grade = input('Enter letter grade for course: ','s');

Iniciar sesión para comentar.

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by