Program Debugging in Mathcad
by Richard Jackson
|
"I am using Mathcad version 13.1. The Start and Stop buttons that are used for debugging are dimmed. I can insert the functions trace and pause into the worksheet, but I am unable to trace any variables." |
|
Power User Richard Jackson replies: |
|
Do you have debugging turned on? There's a button to turn it off and on in the Debug toolbar, (third button). Also make sure the Trace window is open, (fourth button). |
|
Note that the buttons are not designed to control calculation of the worksheet. They are really only useful for a pause statement inside a program. |
|
In general, the buttons are not always available. It depends on where the trace or pause function is. The debug is initially turned off. Toggle it on, and the buttons are still dimmed, because the visible part of the worksheet has finished calculating after you initially load it. |
|
1. Scroll down until you see the first trace statement below. Select it and press [F9]. The buttons momentarily light up as the trace function calculates. You should see two values in the trace window. |
|
2. Scroll down until you see the first pause statement and press [F9]. The buttons are available, and you see two more values in the Trace window. |
|
3. Click on "Interrupt" to kill the calculation, leaving the statement red. |
|
Click on "Resume" to complete calculation of the statement.
For a single statement at the worksheet level trace and pause are kind of pointless though. It's easier to see what's going on by just evaluating a variable. |
|
If you click on "Resume" for the pause statement, then it finishes calculating. If you interrupted it so that the statement is red, then select it and press [F9] and press "Resume."
Next select the first program and press [F9], You see multiple values sent to the Trace window, two for each pass through the loop. |
|
The "Interrupt" button briefly lights up, allowing you to halt execution of the program, basically, it's just the same as pressing [Esc].
If you select the second program and press [F9] both buttons are available because the program pauses each time it goes through the loop.
"Interrupt" kills the program, as it did with the first program, the same as pressing [Esc].
"Resume" passes through the pause statement. Again, you should see multiple values in the Trace window. |
|
For more information on debugging programs using the Debug toolbar and the Trace window, see "Program Debugging" in Online Help, and the Tutorial on "Program Debugging."
This is a sample of the wealth of material you can find in PTC's technical Knowledge Base. You can gain complete access to the Knowledge Base by becoming an active maintenance customer. Learn more
Right-click, choose Save Target As, and change the extension to XMCD and File Type to All to download Mathcad file (version Mathcad 13).
|
Was this tip helpful? Let us know.
| |
[PRINTER FRIENDLY VERSION]
|