Data Acquisition Toolbox
Data Acquisition Toolbox supports PC-compatible data acquisition hardware from multiple vendors, including Advantech, Measurement Computing, and National Instruments. The toolbox also supports Microsoft® Windows® compatible sound cards. In addition, it is compatible with hardware from several data acquisition vendors via third-party adaptors. See more information on supported hardware.
If you work with a variety of hardware, the toolbox provides common base properties that apply to all supported hardware, such as sample rate, trigger settings, and channel properties. Using these properties promotes code reuse and reduces the need to change code when you change hardware. The toolbox also enables you to access device-specific features of your hardware from MATLAB.
To experiment with hardware and collect data interactively, you can execute toolbox functions from the MATLAB command line. You can also create MATLAB applications or work with live data in Simulink models.
Data Acquisition Toolbox lets you make a variety of measurements directly from MATLAB without the need to convert the data. Most data acquisition hardware provides the general capability to convert analog voltage data to a digital signal that a computer can process. Some data acquisition hardware has additional capabilities that allow for collecting and processing data directly from thermocouples, RTD devices, IEPE accelerometers and microphones, current-based sensors, or bridge-based sensors. To facilitate making measurements directly from MATLAB, Data Acquisition Toolbox supports the following measurement types:
Voltage — Data from general purpose A/D cards and sound card recording devices
Current — Data from current-based sensors, such as 4-20 mA sensors commonly used for process control
IEPE accelerometer — Data from IEPE accelerometers that need a constant excitation current source on the same wire on which you measure the acceleration
IEPE microphone — Data from IEPE microphones that need a constant excitation current source on the same wire on which you measure the sound pressure
Thermocouple and RTD — Data measured in degrees Celsius, Fahrenheit, or Kelvin
Bridge-based sensor — Data from resistive sensors, such as strain gauges in a variety of bridge configurations that require an excitation voltage
The toolbox provides functions to access four subsystems commonly found on DAQ hardware: analog input, analog output, digital I/O, and counter/timer. Depending on your application and hardware, you use either the legacy or session-based interface to communicate with the hardware.
The legacy interface supports hardware from multiple vendors and all sound cards on 32-bit versions of MATLAB. (You can use this version of MATLAB on either 32-bit or 64-bit versions of Windows.) The legacy interface also supports voltage measurements of analog input, analog output, and digital I/O subsystems.
The session-based interface supports analog input, analog output, digital I/O, and counter/timer subsystems on both 32-bit and 64-bit versions of MATLAB. This interface supports National Instruments hardware that can perform a wide variety of measurements such as voltage, current, temperature, IEPE accelerometer, and bridge measurements. The session-based interface also supports Windows sound cards and Digilent Analog Discovery hardware.
In either interface, you create device or session objects to provide a gateway to the hardware's functionality and to control the behavior of your acquisition. For example, you can execute any supported analog input task via an analog input object created in MATLAB or Simulink.
By adding channels or lines to your device or session object, you can synchronize the collection of your data. The toolbox supports an unlimited number of channels or lines, enabling you to use as many as your hardware permits.
Analog input functions let you acquire signals from your hardware. You can create an analog input object, add channels to the object, acquire data to memory, read data into the workspace, and preview the most recently acquired data.
Analog output functions let you send signals out from your hardware. You can create an analog output object, add channels, queue data sets for output, and generate analog signals.
Digital I/O functions enable you to generate or read digital signals using your hardware. You can create digital I/O objects, add lines, send data to the hardware, and read data into the workspace. The toolbox supports clocked digital I/O using the session-based interface. The legacy interface of the toolbox provides support for static acquisition and control.
Counter/timer functions let you access counters on data acquisition hardware. You can configure counters as input or output channels. Counters configured as inputs can count events and measure frequency, pulse width, and position; counters configured as outputs can generate pulse trains.
Audio input and audio output functions let you acquire and generate signals using built-in or external sound card. You can create an audio input object, add multiple audio channels to the object, acquire data to memory, read data into the workspace, and preview the most recently acquired audio data.
Data Acquisition Toolbox supports a wide range of functions for controlling your acquisition. For example, you can set event information, evaluate acquisition status, define triggers and callbacks, preview data while a device is running, and perform analysis on the fly. The toolbox also supports several hardware-specific properties that can be displayed and customized to your specifications.
The toolbox provides functions for previewing and extracting data for analysis. It streams data into MATLAB or Simulink in double-precision floating-point format, enabling you to work with the data just as you would with any other matrix in MATLAB or Simulink. You can also use a native hardware format to stream in data.
Data Acquisition Toolbox provides functions for logging data to disk, memory, or both, while an analog input object is running. You can log data, events, and errors. In addition, the toolbox provides functions for extracting data from log files it has generated.
You can interactively select and configure data acquisition sources in MATLAB. A familiar oscillosope-like interface enables you to acquire, view, and analyze data. Through a library of built-in measurement functions, you can verify hardware operation and perform live data analysis. You can extend the interface with your own analysis functions and export data to the MATLAB workspace. This oscilloscope UI is available on the 32-bit version of MATLAB only.
Basic Features of the Oscilloscope Interface
Acquire and display data from data acquisition cards without writing code using the oscilloscope interface.
Advanced Features of the Oscilloscope Interface
Make custom measurements on acquired data and export results to the MATLAB® workspace using advanced features of the oscilloscope interface.
Most data acquisition tasks are initiated by events. An event occurs at a specific time after a condition has been met. Event types supported by Data Acquisition Toolbox include:
Events may result in one or more callbacks. In MATLAB, these event types execute a MATLAB function that you specify.
The session-based interface provides functions for both foreground and background data acquisition. Foreground data acquisition blocks the MATLAB command line; background acquisition does not. Background acquisition enables you to collect data continuously and plot or process the data while you are collecting it. A listener is available to flag session events. When an event occurs, the specified callback function is executed.
Data Acquisition Toolbox provides a consistent set of error and warning messages. If a hardware error message is not handled by the toolbox in MATLAB or Simulink, an external error is reported with the vendor-specific hardware error message.
Data Acquisition Toolbox lets you evaluate the status of an acquisition and the available data acquisition resources, including installed hardware, hardware drivers, and adapters. You can display the following types of information:
Data Acquisition Toolbox provides Simulink blocks for acquiring live or measured data directly into your models, or for configuring hardware interfaced to data acquisition devices. These blocks are only available using the Legacy interface and the 32-bit version of MATLAB.
You can use the blocks to quickly evaluate the response of your Simulink models and algorithms with real-world data instead of designing systems against static data sets, such as those saved in files. You can also use the blocks to verify and validate models against live, measured data as part of the design verification process.
Data Acquisition Toolbox provides six Simulink blocks:
Input blocks let you acquire live data from hardware and then incorporate that data directly into your models. Output blocks let you configure hardware from your Simulink models, including instructing hardware to send data.
Each block enables you to configure parameters including device type, channels, and lines. The analog blocks also enable you to configure other relevant parameters such as asynchronous versus synchronous acquisition, sample rate, block size, and data type. You can connect the Simulink model to a broad range of data acquisition hardware, and later change devices with minimal changes to your model. By using Simulink with Data Acquisition Toolbox, you can verify designs with live data.