Instrument Control Toolbox | ![]() ![]() |
Saving Objects to a MAT-File
You can save an instrument object to a MAT-file just as you would any workspace variable -- using the save
command. For example, to save the GPIB object g
, and the variables cmd
and out
defined in the preceding section to the MAT-file mygpib1.mat
:
Read-only property values are not saved. Therefore, read-only properties use their default values when you load the instrument object into the MATLAB workspace. To determine if a property is read-only, use the propinfo
function or examine the property reference pages.
Loading the Instrument Object
To load an instrument object that was saved to a MAT-file into the MATLAB workspace, use the load
command. For example, to load g
, cmd
, and out
from MAT-file mygpib1.mat
:
The display summary for g
is shown below. Note that the read-only properties such as Status
, BytesAvailable
, ValuesReceived
, and ValuesSent
are restored to their default values.
GPIB Object Using NI Adaptor : GPIB0-1 Communication Address BoardIndex: 0 PrimaryAddress: 1 SecondaryAddress: 0 Communication State Status: closed RecordStatus: off Read/Write State TransferStatus: idle BytesAvailable: 0 ValuesReceived: 0 ValuesSent: 0
![]() | Saving and Loading Instrument Objects | Debugging: Recording Information to Disk | ![]() |