LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript Nugget #7: The MathScript Probe

One of my favorite things about LabVIEW is how easy it is to debug your VIs. You can quickly drop a probe on any wire to see the value flowing down it. Debugging in the MathScript Window is almost as easy: MathScript shows a list of variables and their values and also the textual output from your script. Early versions of the MathScript node offered no such debugging niceties. But starting in LabVIEW 8.5, LabVIEW introduced a feature to help you debug MathScript Nodes that offers the best of both worlds: the MathScript Probe.

You can launch the MathScript probe on a MathScript node by right-clicking on the node and selecting "Probe" or by clicking on a node with the probe tool. This will open a window with two tabs: one for variables and one for output. The variables tab contains a tree with an entry for each node that's being probed. As the node runs, variables appear in the tree. You can click on variables to see their values in the data displays below. You can select different displays depending on the data type of the variable selected. Some of my favorites are the 3D graph to visualize 2D arrays and the sound display to play back 1D audio signals. If you want to view multiple variables at once, you can undock displays and move them around your screen. You can even resize them to see more of your data, something I've wanted from LabVIEW probes for a long time.

The second tab on the MathScript Probe is the output tab. LabVIEW creates one output tab for each MathScript Node that you probe. This is where you can see the output from your executing node and any user-defined functions or scripts called from your node. The output typically shows the results from lines of code that you don't terminate with a semicolon. Some built-in functions like 'disp' also produce output whether you call them with a semicolon or not. Be careful to add the semicolons back when you're done debugging, as they cause a small performance hit even when not attached to the probe.

The next time you're stuck with some misbehaving MathScript code, give the MathScript probe a try! And next week, we'll look at more debugging strategies for MathScript Nodes.

jattas
LabVIEW MathScript R&D

ps Check out previous MathScript Nuggets!
Message 1 of 1
(6,460 Views)