Main Content

Create Script-Based Problems

Write a problem that you want learners to solve using a script. The following procedure walks you through all the steps necessary to create a problem; if you need additional help, click the question mark icon or see Example of a Script-Based Problem.


At any time, you can click Choose Different Problem to abandon the draft and return to Add Problem to make a new selection.

  1. Create a title and detailed problem description for the learner. You can include formatted text, equations, links, and images.

    Clearly define the number and type of input variables and the number and type of expected outputs. Be specific about the types of values or measurements to be used (for example, degrees in Celsius or metric values).

  2. In Files Referenced, provide data and code files that the reference solution, learner solution, and assessment tests can use.

  3. Set Problem Type to Script.

  4. The Reference Solution is the instructor’s solution. The learner cannot see this solution. You can use a reference solution to test your assessments.

  5. If you want to help learners with some of the solution, fill out the Learner Template. This template contains code that you provide to learners to guide them in creating a solution. You decide how much code to provide to help get them started.

  6. To see the actual formatting of your content, click Learner Preview. The preview area displays the view that your learners see.

  7. Click Save as Draft. Learners cannot see the problem while it is in Draft mode. You can continue developing this problem while it is in draft mode.

  8. Write an assessment for the problem.

  9. Click Save as Final when the problem is complete. Or, click Save as Draft continue working on the problem before publishing it.

    If you want to remove a problem from learner view after publishing it, click Set to Draft.

Example of a Script-Based Problem

Create a problem for learners wherein they must add a number to all elements of a vector and plot the results in a grid. While you are authoring a problem, click Save as Draft at any time to save the work you have done so far.

  1. Create title and problem description. Use the toolbar to format text.

  2. Leave Files Referenced empty.

  3. Set Problem Type to Script.

  4. Fill out the Reference Solution with MATLAB® code that demonstrates your solution to the problem.

  5. MATLAB Grader™ uses the reference solution to fill out the Learner Template. You can remove any code you want the learners to provide, for example, variable values or computations.

    The following example shows an array with preassigned values (note that the line of code cannot be changed, indicated by the lock icon) and two comments with instructions. The learner is left to fill in the necessary code.

    To lock lines of code you do not want the learner to change, click the lock icon. You can click Learner Preview at any time to see what your learners will see.

  6. Write assessment tests for the problem. See Write Assessments for Script-Based Learner Solutions.

  7. When you have finished creating this problem, click Save as Final.

Related Topics