MATLAB: Matlab Grader: Feedback for common errors

distance_learningMATLABmatlab grader

HelIo
So I'm looking for a way to give more personalised feedback for students.
In my instance we have students working through material but there are common mistakes where I would like to give specific feedback if they are wrong in a specific way.
A nice example is say students forget that the sample volume is 10ml so their answers are all 10x out. Is it possible to give those students the specific feedback that their answer is 10x out and why and not give this feedback to other students who have the wrong answer for other reasons?
How could I impletment this in matlab grader?
Many thanks
Mark

Best Answer

The current (R2020a) way to achieve this in MATLAB Grader is to use a MATLAB Code assessment type and logical statements to perform the checks sequentially.
Another topic that might also prove helpful is checking multiple correct answers.
As an example, consider a problem where students are to take an input vector vec and, using a for loop, create an array mat where each row contains the vector raised to the row number.
Common errors:
  1. Not capturing the result of each loop
  2. Reversing the assignment indices
In order to check these 2 common errors specifically, plus any other solution students may submit, my assessment code might be:
% First, make sure the student solution contains the expected variable
assert(exist('mat',"var")==1,'Your solution must be assigned to a variable named ''mat''');
if size(mat,1) == 1
% Result only contains one row
assert(false,'Your solution must capture the results of each loop in a row of ''mat''');
elseif size(mat,1) == 4
% Result dimensions appear to be reversed
assert(false,'Your assignment indices may be reversed');
else
% All other scenarios
assessVariableEqual('mat',referenceVariables.mat) %test
end
Note that the custom feedback inside an assert statement will appear in red text.