I keep getting undefined input error
2 ビュー (過去 30 日間)
古いコメントを表示
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: ');
0 件のコメント
回答 (1 件)
Mathieu NOE
2022 年 5 月 10 日
hello
you want to request a string not a number , so the correct code is :
Grade = input('Enter letter grade for course: ',"s");
4 件のコメント
Cris LaPierre
2022 年 5 月 10 日
編集済み: Cris LaPierre
2022 年 5 月 10 日
Try using single quotes for 's', similar to what you did for Course.
Grade = input('Enter letter grade for course: ','s');
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!