Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous analog input and thermocouple acquisition using the NI cDAQ-9172 in Matlab

Hi all, I've been struggling for some time trying to get the simultaneous acquisition of analog voltage and thermocouple data to work. Solely, the analog input works just fine but when the code for thermocouples is added errors are displayed. I am using the NI cDAQ-9172 and am programming in MatlabR2015a. Below is the current code, any tips would be greatly appriciated! 

 

global s;

 

s = daq.createSession('ni');

 

addAnalogInputChannel(s,'cDAQ1Mod1', 0, 'Voltage');
addAnalogInputChannel(s,'cDAQ1Mod1', 1, 'Voltage');
addAnalogInputChannel(s,'cDAQ1Mod1', 2, 'Voltage');
addAnalogInputChannel(s,'cDAQ1Mod1', 3, 'Voltage');

addAnalogInputChannel(s,'cDAQ1Mod5',0, 'Thermocouple');

 

tc = s.Channels(5);


set(tc);
tc.ThermocoupleType = 'K';
tc.Units = 'Celsius';

s

 

 

figure


s.Rate = 10000;

s.IsContinuous = true;

 

 

lh = addlistener(s,'DataAvailable', @graphData);

s.NotifyWhenDataAvailableExceeds = 1000;

 

s.startBackground();


s.wait();
pause(.001);

0 Kudos
Message 1 of 2
(3,837 Views)

This sounds like a technical question, not an idea for a new product feature and is thus offtopic here.

Please decide where it should go and have the moderator move it to the correct forum.

0 Kudos
Message 2 of 2
(3,829 Views)