MATLAB: Function that does not work function problem Why does not this function work: http://bildr.no/view/1000957 this is what i wrote: function grade=onlyundefined(quiz)if quiz<0 ||quiz>10 grade='X'endend Best Answer You stored the function in the file "switchletgrade1.m" . The name of the file needs to match the name of the function.Also, you will need to define the output for the situation when the "if" does not hold true. Related SolutionsMATLAB: Switch function that does not work Your code works error-free for me.Is it possible that you are inadvertently calling a different file with a pre-debugged version? Does the command >> which switchletgrade1give the file location you expect? MATLAB: IF else stement with Logical OR operator problem You should use strcmp(grade,'A') || strcmp(grade,'B') Check the code: grade=input('enter grade of the student:', 's');if (strcmp(grade,'A') || strcmp(grade,'B')) fprintf('student''s grade is %c. excellent Job \n',grade);elseif strcmp(grade,'C') fprintf('student''s grade is %c. well done \n',grade);elseif strcmp(grade,'D') fprintf('student''s grade is %c. Try harder\n',grade);else fprintf('Invalid entry\n');end Related QuestionThere is no Student’s t fitting functionCd workAn example that FSOLVE doesn’t workHow to test plots produced by students’ code in Cody CourseworkHow to enroll multiple students/learners in MATLAB Grader
Best Answer