From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript Nugget #8: Breakpoints, Stepping, Execution Highlighting

In Nugget #7 we discussed one technique for debugging MathScript Nodes: the MathScript Probe. LabVIEW 8.6 introduced some more debugging options to the MathScript Node. You can set breakpoints, step between lines, and turn on execution highlighting on the MathScript Node, just like you can elsewhere in your block diagrams.

These operations are controlled exactly the same as in the rest of LabVIEW. You can step between lines using the buttons on the block diagram toolbar.

debugToolbar.PNG

Use the "Step Into" button to step into a MathScript Node. Use the "Step Over" button to step to the next line. And use the "Step Out" button to stop debugging the MathScript Node. Click the "Highlight Execution" button to slow down execution and show what line is executing. All of these features will draw a small blue triangle next to the line of code that will execute next.

If you'd like to run your code until a particular point and then pause, you can do this using breakpoints. Add breakpoints by clicking with the breakpoint tool in the grey region to the left of the script. You can set breakpoints when the VI is running, enable or disable breakpoints, and view all your breakpoints in the Breakpoint Manager, just like LabVIEW.

While I described these debugging tools in a separate nugget from the MathScript probe, these strategies often work the best when used together. You can attach the probe and set a breakpoint before the section of code that you're interested in. Then you can step past lines and watch values change in the probe. Or if you're not sure where the problem arises, you can run with the probe attached and execution highlighting turned on, and then pause your VI when something strange happens. With these tools, the MathScript Node gives the same basic debugging capabilities as LabVIEW does.

 

So the next time your MathScript node is giving you problems, don't despair. Try debugging it with the probe, breakpoints, stepping, and execution highlighting.

 

jattas

LabVIEW MathScript R&D

 

ps Check out previous MathScript Nuggets!

Message 1 of 1
(6,282 Views)