Using Matlab Grader to check correct name-value pair was used

1 view (last 30 days)
I'm using Matlab Grader for the very first time. I want to use it for a statistics class, so I'm using the statistics package with Matlab. Many of the commands are correct only if you use the correct name-value pair. For example, if I want to do a two-sample t-test for samples with unequal variance I must specify the following command:
ttest2(x1,y,'Vartype','unequal')
I can easily use Matlab Grader to check that they function ttest2 was used, but I also want to confirm the students used the correct 'Vartype'. How do I create a test in Matlab Grader for that?

Accepted Answer

Cris LaPierre
Cris LaPierre on 1 Apr 2020
MATLAB Grader does not have a built-in way to test name value pairs.
If I were going to assess this, I would test the following (in this order)
  1. x1 is correct
  2. y is correct
  3. ttest2 is used
  4. output of ttest2 is correct
In test 4, if the output were not correct, I would remind students to check their name-value pairs in the feedback. It could be as obvious as giving them the correct syntax, or could just be a reminder to check that they are using the correct Vartype. You can even include a hyperlink that will take them directly to the Vartype section of the online documentation for ttest2.
You should adapt the feedback to fit your desires for the learner experience as well as be appropriate for what your learners already know.

More Answers (0)

Communities

More Answers in the  Distance Learning Community

Community Treasure Hunt

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

Start Hunting!