Is there a way to check answers using rand in MATLAB Grader?
I am using MATLAB Grader to check students’ work. Many basic problems ask them to create particular arrays using rand or randi. Is there a way to check if their answer is a possible correct answer?
For example, a problem could ask them to generate a vector v1 of 20 random integers between -4 and 2.
v1 = randi([-4,2],1, 20);
But if I use the assessVariableEqual function to check their answer, it won’t work because their answer contains randomized values. I’d like to be able to check the min, max, and length of the result to see that it is within the expected range. Is there a way to do that?I am using MATLAB Grader to check students’ work. Many basic problems ask them to create particular arrays using rand or randi. Is there a way to check if their answer is a possible correct answer?
For example, a problem could ask them to generate a vector v1 of 20 random integers between -4 and 2.
v1 = randi([-4,2],1, 20);
But if I use the assessVariableEqual function to check their answer, it won’t work because their answer contains randomized values. I’d like to be able to check the min, max, and length of the result to see that it is within the expected range. Is there a way to do that? I am using MATLAB Grader to check students’ work. Many basic problems ask them to create particular arrays using rand or randi. Is there a way to check if their answer is a possible correct answer?
For example, a problem could ask them to generate a vector v1 of 20 random integers between -4 and 2.
v1 = randi([-4,2],1, 20);
But if I use the assessVariableEqual function to check their answer, it won’t work because their answer contains randomized values. I’d like to be able to check the min, max, and length of the result to see that it is within the expected range. Is there a way to do that? grader, rand, randi MATLAB Answers — New Questions