Data Acquisition Toolbox    

Saving and Loading Device Objects

You can save a device object to disk using two possible formats:

For analog input objects, you can also save acquired data, hardware information, and so on to a log file. Refer to Logging Information to Disk for more information.

Saving Device Objects to an M-File

You can save a device object to an M-file using the obj2mfile function. obj2mfile provides you with these options:

For example, suppose you create the analog input object ai for a sound card, add two channels to it, and configure several property values.

The following command saves ai and the modified property values to the M-file myai.m. Because the TriggerFcn property is set to a cell array of values, its value is automatically written to the MAT-file myai.mat.

Use the type command to display myai.m at the command line.

Loading the Device Object

To load a device object that was saved as an M-file into the MATLAB workspace, type the name of the M-file at the command line. For example, to load ai from the M-file myai.m:

Note that the read-only properties such as SamplesAcquired and SamplesAvailable are restored to their default values.

When loading ai into the workspace, the MAT-file myai.mat is automatically loaded and the TriggerFcn property value is restored.


  Saving and Loading the Session Saving Device Objects to a MAT-File