MATLAB® Support
How to Integrate MATLAB with Measurement Computing Products
MATLAB® is a powerful mathematical and modelling SW package that is used by countless engineers and scientists around the world. Because MATLAB is driven by data sets, connecting to real-world information through data acquisition devices is a powerful addition to MATLAB desktop environment.
Data Acquisition application development and support for MATLAB is offered for MCC and Data Translation DAQ devices. Users can access the powerful visualization and analysis capabilities of MATLAB with most MCC and DT hardware.
Support for MATLAB offers the following:
- Easy to use interface for most USB and PCI devices
- Configure device settings and application parameters
- Read data from analog inputs
- Write data to analog outputs
- Access to live measured data directly from MATLAB
- Single environment for acquisition, analysis, and visualization
MCC devices are supported within MATLAB’s Data Acquisition Toolbox, while DT devices are supported through the
DT DAQ Adaptor for MATLAB Data Acquisition Toolbox Support Package (included free with most DT devices). Each driver offers different supported functionality. See the chart below.
Supported features for MCC and DT devices:
Devices |
Analog Input |
Analog Output |
Digital I/O |
Counters/Timers |
MCC |
Yes |
Yes |
— |
— |
DT |
Yes |
Yes |
Yes |
Yes |
Note: Specialized inputs like thermocouples and the use of Simulink data acquisition blocks are not supported.
Building a Program using MATLAB and an MCC Device

Programming data acquisition devices in MATLAB is relatively straight forward. Below are the basic steps to creating a MATLAB application with MCC USB DAQ devices.
Configuring and Controlling a Device
MCC devices are configured directly within MATLAB using the Data Acquisition Toolbox where users can take advantage of MATLAB’s powerful analysis and data presentation tools.
Discover Available Devices
Use the
daq.getDevices function to display a list of devices available to your machine and MATLAB.
devices = daq.getDevices
devices =
Data acquisition devices:
index |
Vendor |
Device ID |
Description |
1 |
mcc |
Board0 |
Measurement Computing Corp. USB-1208FS-Plus |
2 |
mcc |
Board1 |
Measurement Computing Corp. USB-1608GX-2AO |
3 |
mcc |
Board2 |
Measurement Computing Corp. USB-1604HS-2AO |
4 |
mcc |
Board3 |
Measurement Computing Corp. USB-1608FS-Plus |
5 |
mcc |
Board4 |
Measurement Computing Corp. USB-1616FS |
Learn Device Details
To learn more about an individual device, click the name of the device in the list in the Command window, or access the device in the array returned by the
daq.getDevices function.
devices(2)
ans =
mcc: Measurement Computing Corp. USB-1608GX-2AO (Device ID: 'Board1')
Analog input subsystem supports:
4 ranges supported
Rates from 0.1 to 500000.0 scans/sec
16 channels ('Ai0' - 'Ai15')
'Voltage' measurement type
Analog output subsystem supports:
-10 to +10 Volts range
Rates from 0.1 to 500000.0 scans/sec
2 channels ('Ao0','Ao1')
'Voltage' measurement type
Acquire Data
- Create a session describing the operation to perform
- Add input channels to the session
- Start the acquisition
The
daq.createSession function creates a session. The session contains information describing the hardware, scan rate, duration, and other properties associated with the acquisition. Create a session, and assign it to a variable.
s = daq.createSession('mcc')
s =
Data acquisition session using Measurement Computing Corp. hardware:
Will run for 1 second (1000 scans) at 1000 scans/second.
No channels have been added.
By default, the session is configured for 1000 scans per second and a duration of one second. For this example, accept these defaults.
The
addAnalogInputChannel function attaches an analog input channel to the session. You can add more than one channel to a session. For this example, add only one.
addAnalogInputChannel(s,'Board1',0,'Voltage');
s
s =
Data acquisition session using Measurement Computing Corp. hardware:
Will run for 1 second (1000 scans) at 1000 scans/second.
Number of channels: 1
index |
Type |
Device |
Channel |
MeasurementType |
Range |
Name |
1 |
ai |
Board1 |
Ai0 |
Voltage (Diff) |
-10 to +10 Volts |
|
The
startForeground function starts the acquisition and returns the results.
data = startForeground(s);
The session has acquired 1000 scans. Plot a portion of the acquired data:
plot(data)
Change Default Properties of the Acquisition
By default, sessions run for one second at 1000 scans per second. To acquire at a higher rate for a longer time, change the
Rate and
DurationInSeconds properties.
s.Rate = 5000;
s.DurationInSeconds = 2;
s
s =
Data acquisition session using Measurement Computing Corp. hardware:
Will run for 2 seconds (10000 scans) at 5000 scans/second.
Number of channels: 1
index |
Type |
Device |
Channel |
MeasurementType |
Range |
Name |
1 |
ai |
Board1 |
Ai0 |
Voltage (Diff) |
-10 to +10 Volts |
|
Run the acquisition and plot the acquired data:
data = startForeground(s);
plot(data)
The Live Data Acquisition (GUI) example is included with MATLAB’s Data Acquisition Toolbox. It allows users to quickly and easily take data from an MCC device.
Extensive Hardware Selection
MCC offers a large selection of MATLAB supported data acquisition solutions for a wide range of applications. Choose from USB and PCI devices designed to meet any budget.
