There is currently no way to suppress the default feedback when using the built-in assessment function assessVariableEqual. The alternative is to instead perform the grading using assert statements. Assert will only show the message you provide (see tips below for more). To duplicate the behavior of assesVariableEqual, you must
- First determine if the student variable exists.
- Next, determine if the student variable is the same data type as the reference variable.
- Then determine if the student variable is the same size as the reference variable.
- Finally, determine if all the values in the student variable are the same as the values in the reference variable. For numeric values, apply a tolerance.
The first 3 tests are necessary to ensure the values can be compared without causing an error.
Here's an example (untested):
assert(exist('f')==true,'The submission must contain a variable named f')
assert(isa(f,'double'),'Variable f must be of data type double.')
assert(all(size(f)==size(referenceVariables.f)),'Variable size is incorrect');
assert(all(abs(f-referenceVariables.f)<0.0001),'The variable f contains an incorrect value');
Best Answer