<< Chapter < Page Chapter >> Page >
This module gives a very brief introduction to some of the concepts behind programming in LabVIEW MathScript using m-file syntax.

You can use LABVIEW MathScript code to automate computations. Almost anything typed at the command line can also be included in a LABVIEW MathScript program. Lines in a LABVIEW MathScript script are interpreted sequentially and the instructions are executed in turn. This simplifies repetitive computations. This allows you to create complex computations that cannot be readily implemented using commands at the command line. You can also create computational capabilities for other people to use.

LABVIEW MATHSCRIPT scripts are text files and can be edited by any text editor. Any script should run the same on any computer running LABVIEW MATHSCRIPT regardless of its operating system. Script files must have an extension of ".m" and be in a directory that LABVIEW MATHSCRIPT knows about.

LABVIEW MATHSCRIPT scripts interact with the current LABVIEW MathScript environment. Variables set before the script is executed can affect what happens in the script. Variables set in the script remain after the script has finished execution.

One way to edit LABVIEW MATHSCRIPT scripts is to use the built-in editor. The editor has some features that make editing LABVIEW MATHSCRIPT scripts easier. The editor is integrated with the debugger which makes finding and correcting errors in your scripts easier. More detailed information about editing scripts can be found at National Instruments LabVIEW MathScript Tutorial-Inside LabVIEW MathScript Tutorial .

Use comments to remind you and help other users understand how you have implemented your program. Comments begin with the character %.

For LABVIEW MATHSCRIPT to correctly execute a script, it must know the directory in which the script resides. There are several ways to do this. One is to set the current working directory for LABVIEW MATHSCRIPT from the File>MathScript Preferences in the MathScript interactive window. More detailed information can be found at National Instrument's LabVIEW MathScript Preferences Dialog Box .

M-file names should begin with a letter and only contain letters and numbers. Any other characters (space, dash, star, slash, etc.) will be interpreted by LABVIEW MATHSCRIPT as operations on variables and will cause errors. Also, M-file names should not be the same as variables in the workspace, since LABVIEW MATHSCRIPT will not be able to differentiate between the file name and the variable.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Introduction to labview mathscript. OpenStax CNX. Aug 06, 2006 Download for free at http://cnx.org/content/col10370/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Introduction to labview mathscript' conversation and receive update notifications?

Ask