Inspecting and Changing Variable Values
Use the Variables view to inspect and change the values of variables.
By default, the Variables view shows variables in the current execution context. This means that if IDL has halted execution in the middle of a routine, variables local to that routine are visible in the View. (System variables are visible in all contexts.) You can change the values of scalar variables by selecting them in the Value field of the Variables view, entering a new value, and pressing return. See Variables View for details.
Note that you can view and change the values of variables in any execution context by selecting the context in the Debug view. When you select a new context, the Variables view updates to display the variables in that context. You can explore this behavior if you have created the BREAKPOINT_TEST routine described in Managing Breakpoints.
- With no programs running (that is, in the $MAIN$ context), create a variable name
myvariable: - Open the breakpoint_test routine in the IDL editor.
- Set a breakpoint on the line that starts the FOR loop, if one is not already set. Disable any other breakpoints.
- Run breakpoint_test. Notice that the Variables view shows the variables that are local to the BREAKPOINT_TEST routine:
iandmultiplier. - Click on $MAIN$ in the Debug view. Notice that the Variables view now displays variables defined in the $MAIN$ context, including
myvariable. - Click on the value of
myvariablein the Variables view and change it to 299.11. Press Enter to save the change. - Press F8 to restart the BREAKPOINT_TEST routine. It should run to completion.
- We are now back in the $MAIN$ context. Note that the
myvariablevariable has the value you set while stopped in the middle of the BREAKPOINT_TEST routine.