Is it possible to suppress the default error message of the function assessVariableEqual?
Mostra commenti meno recenti
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.
Risposta accettata
Più risposte (1)
David Kosfelder
il 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
Community
Più risposte nel Distance Learning Community
Categorie
Scopri di più su Create Courses and Assessment Items in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


