Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

save (MathScript RT Module Function)

LabVIEW 2010 Help

Edition Date: June 2010

Part Number: 371361G-01

»View Product Info

Owning Class: support

Requires: MathScript RT Module

Syntax

save

save file

save file a b ... c

Description

Saves variables to a file. save and save file save all variables to a file. save file a b ... c saves variables a, b, ..., c to a file. You can specify an unlimited number of variables to save. You must use the save function to save variables to a file before you can load those variables with the load function.

The file string can be an absolute path or a path relative to the current working directory. If you do not specify file, LabVIEW saves the variables to the default.mlv file in the current working directory.

Details

Examples

Details

You can use the save function in the following situations:
  • To save variables to a .mlv file.
  • (Windows) To save variables to a binary measurement file (.tdm or .tdms). You then can exchange data between NI software, such as LabVIEW and DIAdem. When you use the save function to save variables to a .tdm or .tdms file, LabVIEW saves each variable as a channel group. The name of the variable determines the name of the channel group. If the .tdm or .tdms file you specify already exists, LabVIEW overwrites the original file. LabVIEW also creates a backup copy of the original file.
  • (Windows) To save data to an external data file, such as a .csv or .mdf file. To save data to an external data file, you first must install the correct National Instruments DataPlugins. Refer to the National Instruments Web site to download DataPlugins.
You also can use the fwrite_csv function to save data to a .csv file.

You cannot use the previous syntax to save to a file whose name you define in a variable. Use the syntax in the following example to save the variable A to a file named myfile, which you define in the fname variable.
fname = 'myfile'
save(fname, 'A')

Changes you make to the working directory using the cd function apply only to the current instance of the LabVIEW MathScript Window or the MathScript Node from which you call the function. Changes to the working directory for one MathScript Node do not apply to any other MathScript Nodes. LabVIEW resets the working directory to the default when you close the LabVIEW MathScript Window or when the MathScript Node stops executing. Use the MathScript: Search Paths page of the LabVIEW MathScript Properties dialog box to change the default working directory for the LabVIEW MathScript Window. Use the MathScript page of the Options dialog box to change the default working directory for MathScript Nodes in the main application instance.

If you call this function from a MathScript Node, LabVIEW operates with slower run-time performance for the MathScript Node. To optimize the performance of the MathScript Node, remove this function from scripts.

This function is not supported in the LabVIEW Run-Time Engine. Do not use this function in a stand-alone application or shared library.

Examples

clear all
A = 12
save
clear all
load
B = A+1

Related Topics

cd
fwrite_csv
load
pwd


 

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