DAQmx examples

Examples of talking to a National Instruments (NI) DAQ card without the data acquisition toolbox.
2.1K Downloads
Updated 14 May 2010

View License

Examples of using matlab to talk to a National Instruments (NI)
DAQ card _without_ the 'data acquisition toolbox'

I have mainly used code and examples from Jens Roesner here:
http://www.jr-worldwi.de/work/matlab/index.html
However, I had to make a few slight tweaks to get it to work for me. I have only tested this on Matlab 7.8.0 (R2009a) on WinXP with a NI PCI 6220 board, so no guarantees.

Using Jens' code, I got an error -200088 whenever I tried to create a channel. To get it working, I had to change the initial task handles to uint32([]) which then returned a pointer for taskhandle

I also had trouble with creating tasks, then losing the taskhandle, and not being able to create the same task because of a name conflict. The solution is to not name any of the tasks - names don't seem to be useful anyway. So all my functions pass an empty string as a name.

Other changes are just cosmetic -
made functions for common tasks to simplify my main code
put all task handles in structure so easy to clear

Cite As

Nathan Tomlin (2024). DAQmx examples (https://www.mathworks.com/matlabcentral/fileexchange/27609-daqmx-examples), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Data Acquisition Toolbox Supported Hardware in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0