How can I synchronize acquired digital and analog signals at different rates using Data Acquisition Toolbox?

2 views (last 30 days)
I would like to read in both the digital and analog inputs from my I/O board using Data Acquisition Toolbox, but they are acquired at a different rate.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
You can acquire the digital signal on an analog channel by connecting the physical wire which is the digital input to an analog input channel. Then you can read the digital input as an analog input and get a series of data points corresponding to the digital signal over time, using the following command:
[data, time] = getdata(ai);
The digital data will be in the column that corresponds to that channel and it will be synchronized with the columns that represent the analog input.
The Data Acquisition Toolbox documentation includes an example on "Counting Complex Events Using Analog Input Data" which should be helpful.
Digital IO objects in the DAQ toolbox are fundamentally different from Analog IO objects. With digital IO objects you only read and write single values. Consult the documentation for further information on this difference.
You can't really "record" data from a digital IO object. Options include connecting the digital IO signal to an analog channel as described above, or creating a loop in MATLAB to continuously read the digital signal or using timer callbacks to record values at specific intervals.

More Answers (0)

Categories

Find more on Simultaneous and Synchronized Operations in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!