Debug General-Purpose Experiments - MATLAB & Simulink (original) (raw)
Main Content
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:
- Open the experiment.
- In the Experiment Manager toolstrip, select >
.
- In dialog box, specify the parameter values for your experiment.
- Click Start.
To debug your code after you run the experiment:
- Open the results for the experiment.
- 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.
- 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.
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