Why the assessment shows the keyword not presented however it is in the code in the MATLAB grader?

1 view (last 30 days)
Sihe Zhang
Sihe Zhang on 28 Mar 2022
Commented: Cris LaPierre on 29 Mar 2022
In MATLAB Grader, I set up the reference solution, added two assessment, one to check the keywords' presence and the other check the results. Then I run the same answer code in the learner's view and submit the answer, the assessment showed that the keywords missing and results wrong, which is not the case by the code nor the results. What happened wrong?
e.g. Code: z=sort(x,'descend')
In Assessment: 1. check if keywords used: sort, descend
2. check if the variable z is the same as in the reference solution
Even if the code are correct and z is correct, the auto-assessment shows "descend" is missing and the result is not correct.

Answers (1)

Cris LaPierre
Cris LaPierre on 28 Mar 2022
Edited: Cris LaPierre on 28 Mar 2022
The reason is that descend is not a function or keyword. It is an input argument to the sort function.
ans = 0
ans = logical
Cris LaPierre
Cris LaPierre on 29 Mar 2022
There is curently no built-in way to assess function inputs. However, you could code your own test in a MATLAB Code test type. The code would have to import the learner's script as text and then parse through the text to see if descend is used.
Without knowing how x is created in the reference and learner solutions, it is impossible to say why z is being marked as incorrect.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!