Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

Defining a Function or Script (MathScript RT Module)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

You cannot execute MathScript functions directly. In other words, you first must define and save a function before you can call the function with inputs and outputs in the LabVIEW MathScript Window or the MathScript Node. Complete the following steps to create a function or script and prepare it for use in the LabVIEW MathScript Window or MathScript Node.

Caution  If you define a function with the same name as a built-in MathScript RT Module function, LabVIEW executes the function you defined instead of the original function. When you execute the help command, LabVIEW returns help content only for the function you defined. You cannot retrieve the help content for the original MathScript RT Module function.
  1. In the Script Editor on the Script page of the LabVIEW MathScript Window, create a function or script using the proper syntax. You also can use a text editor to create the function or script.
Note Note  To open a new Script Editor in a separate window, select File»New Script Editor or right-click the Script Editor on the Script page and select New Script Editor from the shortcut menu.
  1. Save the function or script. The filename for a function must be the same as the name of the function and must have a lowercase .m extension. For example, the filename for the foo function must be foo.m. Use unique names for all functions and scripts. You must save the function or script in a directory in the MathScript search path.
Note  If you define a function with the same name as a built-in MathScript RT Module function and want to revert to the original function, either delete the function you defined, rename the function you defined to a name that is different from the built-in MathScript RT Module function, or remove the path that contains the function you defined from the default search path list. After you remove the path, LabVIEW no longer loads the function you defined into memory because the list LabVIEW searches does not include the path to the function.

After you define and save a function, you can call the function you defined from the LabVIEW MathScript Window or the MathScript Node.


 

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit