LabVIEW 2012 MathScript RT Module Help
»View Product Info
Owning Class: support
Requires: MathScript RT Module
load file a b ... c
a = load(file)
Loads variables or data from a file. load and load file load all variables from a file. load file a b ... c loads variables a, b, ..., c from a file. You can specify an unlimited number of variables to load. 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 loads the variables from the default.mlv file in the current working directory.
If file loads from the current working directory, you can specify just its filename. If file loads from a location outside of the current working directory, you must specify its path and use single quotation marks to define it as string.
You can use the load
function in the following situations:
- To load variables from a .mlv file you saved using the save function.
- To load variables from a .mat file you saved using version 6.0 or earlier of the MATLAB® software.
- (Windows) To load channel data from a binary measurement file (.tdm or .tdms) you saved using NI software, such as LabVIEW or DIAdem. If you saved the file using LabVIEW MathScript, LabVIEW loads each channel group from the file as a matrix variable. The name of the channel group determines the name of the variable. If you did not save the file using MathScript, LabVIEW loads each channel from the file as a matrix variable. The name of the channel determines the name of the variable.
- (Windows) To load data from an external data file, such as a .csv or .mdf file. To load data from an external data file, you first must install the correct National Instruments DataPlugins. Refer to the National Instruments website to download DataPlugins.
- To load data separated by spaces, commas, or tabs from ASCII files. You must use the following syntax to load data from ASCII files: a = load(file). You cannot use this syntax to load data from .mlv, .mat, .tdm, or .tdms files.
You also can use the fread_csv
function to read data from a .csv
The file path that you specify can be relative to the working directory. 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
This function is not supported in the LabVIEW Run-Time Engine
or on RT targets unless you use the following syntax to load data from ASCII files: a = load(file)
. In all other cases, do not use this function in a stand-alone application
or shared library
, or on RT targets. If you call load
with the previous syntax in an application or shared library, LabVIEW searches for the file in the path where you installed the application or shared library. (Real-Time Module)
If you deploy this function to an RT target, LabVIEW searches for the file in the path returned by the Default Data Directory VI.
The following table lists the support characteristics of this function.
|Causes reduced performance ()
|Supported in the LabVIEW Run-Time Engine
|Supported on RT targets
|Suitable for bounded execution times on RT
No (affects entire script)
A = 12
B = A+1
load 'C:\Program Files\National Instruments\data.mlv'