One day Matlab will port the data acquisition toolbox to OSX and we will all be happy. Until that time we are stuck with fiddly-farting around with the NI-DAQmx Base drivers.
My setup:
Another possible method of using the NI drivers is to use the loadlibrary and calllib functions in Matlab. I got a head-start in this direction by reading this for M-series cards.
There are a number of annoying caveats to getting this to work. The first is that the libraries that I have don't have an extension. This causes a problem because Matlab insists that they have a .dylib extension. Therefore, I copied the library "nidaqmxbase" from
/Library/Frameworks/nidaqmxbase.framework/Versions/3/nidaqmxbase
and renamed it to nidaqmxbase.dylib
I put this file and the header file
/Applications/National Instruments/NI-DAQmx Base/Includes/NIDAQmxBase.h
into a common directory. Remember that this header file is your friend, you can look up the necessary error codes directly and get the appropriate values for the defined values.
Now you can load the library:
mx_LibraryName = 'nidaqmxbase';
if ~libisloaded(mx_LibraryName)
loadlibrary(mx_LibraryName,'NIDAQmxBase.h');
end
And then painfully start creating functionality using the calllib function, e.g.
% DAQmxBaseCreateTask
mx_TaskName = h.TaskName;
mx_TaskHandle = [];
[mx_ErrorID,mx_TaskName,mx_TaskHandle] = calllib(mx_LibraryName,'DAQmxBaseCreateTask',mx_TaskName,mx_TaskHandle);
Attached to the end of this page are some very basic files that recreate the contAcquireNchan.c example.