Is it possible to suppress the default error message of the function assessVariableEqual?
Show older comments
For my Matlab Grader Courses I use the build in function assessVariableEqual.
In order to give the students a better hint for the correct solution I define my own error messages with the keyword 'Feedback' in the function.
Sometimes the default error message is confusing for the students and I want to suppress the message, but there seems to be no possibility to do so.
Accepted Answer
More Answers (1)
David Kosfelder
on 25 Nov 2020
From my observation Matlab Grader uses errors to fail a test. assessVariableEqual throws an exception if a variable is not equal. You can use try/catch to filter it out and fail the test manually. The second argument makes the message multi-line.
try
assessVariableEqual('avgX',referenceVariables.avgX);
catch
error("The test has failed.\nYour submission is wrong", "");
end
Communities
More Answers in the Distance Learning Community
Categories
Find more on Create Courses and Assessment Items in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

