I've calibrated my NI-DAQ using Measurement and Automation and now I want to use this saved task in Matlab so that I can ensure it's recording at the correct range etc. I can't figure out how to call this task from Matlab.
Any help would be greatly appreciated. I have gone through many of the DAQ toolbox guides but they don't mention calibration or how to call a task in Matlab.
I'd prefer to use the legacy interface since I have Matlab R2010a but I can upgrade and use the session interface if it's easier to work with.
No products are associated with this question.
Currently there is no way to use a saved Measurement and Automation task in MATLAB. Measurement and Automation does not give a way to access the task outside their software.
The Data Acquisition Toolbox currently does not have any in built calibration features. However having said that, you could always use MATLAB's interpolation functions.
So for example if you wanted to perform a 5 step calibration for a channel with range -10 to 10 Volts.
1. Supply -10V,-5V,0V ,5V,10V to your channel one by one and measure the actual voltage using the Data Acquisition Toolbox functions. You can run a clocked acquisition and average the results over some number of samples using the mean function
2. Now say your measured values were [ -9.1, -5.3, 0.1, 5.4, 9.8 ]
3. Now you can write your own calibrate function
function calibrated_values = calibrate(raw_values) measured_values = [ -9.1, -5.3, 0.1 ,5.4, 9.8 ]; reference_values = [ -10 ,-5 , 0, 5 ,10 ]; calibrated_values = ... interp1(measured_values,reference_values,raw_values); end
interp1 by default uses Liner interpolation. There are many different ways in which you can interpolate your data, you can look at other options provided by the interp1 function .
4. Now after acquiring data, you can use your calibrate function.
Hope this helps,
Play games and win prizes!Learn more