MATLAB Answers

Karthik
0

Reading Data from NI USB-6000

Asked by Karthik
on 5 Sep 2014
Latest activity Commented on by Walter Roberson
on 30 Jan 2018
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.
Property: DAQmx_AI_Coupling
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.
Thanks

  0 Comments

Sign in to comment.

1 Answer

Answer by Pawel
on 17 Sep 2014
Edited by 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:
MATLAB\R2014a\toolbox\daq\daq\+daq\+ni\AnalogInputVoltageChannel.m
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(...
% taskHandle,...
% obj.PhysicalChannel,...
% daq.ni.utility.DAQToNI(obj.CouplingInfo));
%daq.ni.utility.throwOrWarnOnStatus(status);
% code
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.

  2 Comments

Hi Pawel. I try to edit the file but i couldn't save the file it says Accees denied. Please help
Run As Administrator, make the changes, save, exit MATLAB to stop running as administrator.

Sign in to comment.