Main Content

Debug General-Purpose Experiments

In Experiment Manager, diagnose problems in your experiment function by stepping through your code line-by-line and examining the values of your variables.

Start Debugging Session

You can debug your code before or after you run the experiment.

To debug your code before you run the experiment:

  1. Open the experiment.

  2. In the Experiment Manager toolstrip, select Run > Debug .

  3. In dialog box, specify the parameter values for your experiment.

  4. Click Start.

To debug your code after you run the experiment:

  1. Open the results for the experiment.

  2. In the results table, select a trial to debug. To ensure reproducibility, Experiment Manager reuses the parameter values and the random seed saved for this trial.

  3. Right-click the trial and select Debug .

Experiment Manager opens the experiment function in MATLAB® Editor, places a breakpoint in the first line of code, and runs the function.

Experiment Manager sets a breakpoint on the first line of code in your experiment function.

Debug Experiment Function

When you debug your experiment function, MATLAB pauses at each line of code that has a breakpoint. You can add other breakpoints to your function, view the values of your variables, step through the code line-by-line, or continue to the next breakpoint. For more information, see Debug MATLAB Code Files.

Verify Your Results

After your function runs to completion, verify your results by examining the parameters and output values stored in workspace variables, where functionName is the name of the experiment function.

  • functionName_params — A structure with fields from the Experiment Manager parameter table

  • functionName_output — A cell array that contains the output values returned by the experiment function

See Also

Apps

Related Topics