LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript Nugget #5: Feedback as you type

Today we present the first MathScript Nugget that you can try in LabVIEW 8.6 (aka LabVIEW 2008). That's when the MathScript Node started working its magic on every keystroke you make in your script.

There are two places in the MathScript Node where you can see feedback as you type: the text itself and the gray area immediately to the left of the text.

 


 
The gray area can show two different glyphs: a red 'X' to indicate an error and a yellow triangle to indicate a warning. Errors can indicate anything that's wrong with your script at edit time: calling functions with the wrong number of inputs, referencing undefined variables, and misusing operators are just a few examples. Your VI will be broken until you fix the errors. Warnings don't necessarily indicate problems with your code, but rather issues to investigate and understand. Examples of these include calling built-in functions that degrade performance of your entire script, or calling user-defined .m files that call such built-in functions. I'll go into more detail about warnings in a future nugget.

The second place to see immediate feedback is in the script itself. Here the feedback appears in the form of syntax highlighting, which highlights different constructs with different colors. For example, built-in functions appear in blue, user-defined functions in purple, unknown symbols in gray, and comments in green. You can configure highlighting in the MathScript page of the Tools>>Options dialog. You can also disable it on a per-node basis by right-clicking on a node and setting Script Highlighting to "None".

There thing I really like about these features is that they help you quickly fix your code when it's broken. For example, I'm often not sure of a function name when I'm developing. Thanks to syntax highlighting, I can quickly try a few different options. When my attempt changes from gray to blue, I know I've got it right. Or if I load up a VI and see a red 'X' next to a line with a gray unknown symbol, I suspect that I'm missing a .m file. I can add it to my search path and immediately know that MathScript has found it when it colors the call in purple.

The next time you’re developing with MathScript, take a moment to enjoy the instantaneous feedback coming from the MathScript Node!

jattas
LabVIEW MathScript R&D

 

ps Check out previous MathScript Nuggets here!

Message Edited by jattas on 11-02-2009 05:32 PM
Message Edited by jattas on 11-02-2009 05:33 PM
Message 1 of 1
(6,518 Views)