Reading Data from NI USB-6000
21 views (last 30 days)
I'm trying to read data from an NI USB-6000 into 32 bit Matlab for an experiment. I was able to view the data in the NI MAX program, but the DAQ toolbox in MATLAB gives the following error:
mydaq.addAnalogInputChannel('dev1', 'ai0', 'Voltage')
NI Error -200452:
Specified property is not supported by the device or is not
applicable to the task.
Channel Name: Dev1/ai0
Task Name: _unnamedTask<1A>
Status Code: -200452
When it says "not applicable to the task" I'm not sure what my options are to fix that error. If it's a question of the DAQ card's compatibility, I'm wondering if there are any possible ways to work around the issue before I look into replacing the DAQ card.
Pawel on 17 Sep 2014
Edited: Pawel on 17 Sep 2014
NI USB-6000 and its family are not supported by Matlab officially. However, by modifying the DAQ toolbox in matlab you can get it to work. It goes without saying that I do not make any guarantees. Before messing with Matlab's code, make a backup.
The problem seems to be that this family of devices does not need to set the AI coupling or there is a different way to set it than the way matlab previously implemented for NI devices. As far as I can tell, the solution is stable/works but more testing is needed and it may result in bugs. I should also note that some of Matlab's functions seem to work right out of the box - adding digital channels for instance.
To get your DAQ to work, go into the directory which holds matlab. You will need to be administrator on the computer to make these changes. Go to the following file:
On line 56 you see the function configureTask. Simply comment out the code under % Set the Coupling:
% Set the Coupling
%[status] = daq.ni.NIDAQmx.DAQmxSetAICoupling(...
This prevents the code which sets the coupling from being executed. From what I've seen it doesn't seem this is necessary in these new USB DAQs, but I will edit accordingly if I run into problems.