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!