s = daq.createSession('ni');
tx = daq.createSession('ni');
ch1 = addAnalogInputChannel(tx,'Dev1', 'ai0', 'Voltage');
ch2 = addAnalogInputChannel(s,'Dev1', 'ai1', 'Voltage');
s.Rate = 8000;
data1 = tx.inputSingleScan;
data2 = s.inputSingleScan;
disp(data1)
disp(data2)
subplot(2,1,1)
tx.DurationInSeconds = 2;
[data1,time] = tx.startForeground;
plot(time,data1);
xlabel('Time (secs)');
ylabel('Voltage')
subplot(2,1,2)
s.DurationInSeconds = 5;
[data2,time] = s.startForeground;
plot(time,data2);
xlabel('Time (secs)');
ylabel('Voltage')
[up,lo] = envelope(data2, 300);
maxAmplitude = peak2peak(up-lo);
disp(maxAmplitude)
>>showOutputInput
5.3680e-04
2.4084
エラー:showOutputInput(line 37)
The hardware associated with this session is reserved. If you are using it in another
session use the release function to unreserve the hardware. If you are using it in an
external program exit that program. Then try this operation again.