Instrument Control Toolbox    

Example: Recording Information to Disk

This example extends Example: Reading Binary Data by recording the associated information to a record file. Additionally, the structure of the resulting record file is presented.

  1. Create an instrument object -- Create the GPIB object g associated with a National Instruments GPIB controller with board index 0, and an instrument with primary address 1.
  2. Configure properties -- Configure the input buffer to accept a reasonably large number of bytes, and configure the timeout value to two minutes to account for slow data transfer.
  1. Configure g to execute the callback function instrcallback every time 5000 bytes are stored in the input buffer.

    Configure g to record information to multiple disk files using the verbose format. The first disk file is defined as WaveForm1.txt.

  1. Connect to the instrument -- Connect g to the oscilloscope.
  2. Write and read data -- Initiate recording.
  1. Configure the scope to transfer the screen display as a bitmap.

    Initiate the asynchronous read operation, and begin generating events.

    instrcallback is called every time 5000 bytes are stored in the input buffer. The resulting displays are shown below.

    Wait until all the data is stored in the input buffer, and then transfer the data to MATLAB as unsigned 8 bit integers.

    Toggle the recording state from on to off. Because the RecordMode value is index, the record filename is automatically updated.

  1. Disconnect and clean up -- When you no longer need g, you should disconnect it from the instrument, and remove it from memory and from the MATLAB workspace.

The Record File Contents

To display the contents of the WaveForm1.txt record file:

The record file contents are shown below. Note that data returned by the fread function is in hex format (most of the bitmap data is not shown).


  The Record File Format Function Reference