Data Acquisition Toolbox    

Overview

The data acquisition session consists of all the steps you are likely to take when acquiring or outputting data. These steps are

  1. Create a device object -- You create a device object using the analoginput, analogoutput, or digitalio creation function. Device objects are the basic toolbox elements you use to access your hardware device.
  2. Add channels or lines -- After a device object is created, you must add channels or lines to it. Channels are added to analog input and analog output objects, while lines are added to digital I/O objects. Channels and lines are the basic hardware device elements with which you acquire or output data.
  3. Configure properties -- To establish the device object behavior, you assign values to properties using the set function or dot notation.
  1. You can configure many of the properties at any time. However, some properties are configurable only when the device object is not running. Conversely, depending on your hardware settings and the requirements of your application, you might be able to accept the default property values and skip this step.

  1. Acquire or output data -- To acquire or output data, you must execute the device object with the start function. While the device object is running, it behaves according to the previously configured or default property values.
  1. After data is acquired, you must extract it from the engine with the getdata function. Before you can output data, you must queue it in the engine with the putdata function.

  1. Clean up -- When you no longer need the device object, you should remove it from memory using the delete function, and remove it from the MATLAB workspace using the clear command.

The data acquisition session is used in many of the documentation examples included in this guide. Note that the fourth step is treated differently for digital I/O objects because they do not store data in the engine. Therefore, only analog input and analog output objects are discussed in this section.

Example: The Data Acquisition Session

This example illustrates the basic steps you take during a data acquisition session using an analog input object. You can run this example by typing daqdoc3_1 at the MATLAB command line.

  1. Create a device object -- Create the analog input object AI for a sound card. The installed adaptors and hardware IDs are found with daqhwinfo.
  2. Add channels -- Add two channels to AI.
  3. Configure property values -- Configure the sampling rate to 11.025 kHz and define a 2 second acquisition.
  4. Acquire data -- Start AI and extract all the data from the engine. Before start is issued, you might want to begin inputting data from a microphone or a CD player.
  1. Plot the data and label the figure axes.

  1. Clean up -- When you no longer need AI, you should remove it from memory and from the MATLAB workspace.

  The Data Acquisition Session Creating a Device Object