Timeout expired: DAQ read and plot

19 次查看(过去 30 天)
Hey, I have a signal from the signal generator over a PCI-6123 and it should be read in with Matlab and be plotted. But it is an infinite signal and startForeground does not work, is there a possibility to sampel the signal (with inputSingleScan) for e.g. 3 seconds, make an array with the values and then plot these? Or is there any other possibility to read in and Plot the signal? Here is my code and my output
if true
devices = daq.getDevices
devices()
s = daq.createSession('ni');
addAnalogInputChannel(s,'Dev1', 0, 'Voltage');
s.Rate = 8000
data = s.inputSingleScan
[data,time] = s.startForeground;
plot(time,data);
xlabel('Time (secs)');
ylabel('Voltage')
end
output:
devices =
ni: National Instruments PCI-6123 (Device ID: 'Dev1') Analog input subsystem supports: 4 ranges supported Rates from 0.1 to 500000.0 scans/sec 8 channels ('ai0' - 'ai7') 'Voltage' measurement type
Digital subsystem supports:
Rates from 0.1 to 10000000.0 scans/sec
8 channels ('port0/line0' - 'port0/line7')
'InputOnly','OutputOnly','Bidirectional' measurement types
Counter input subsystem supports:
Rates from 0.1 to 20000000.0 scans/sec
2 channels ('ctr0','ctr1')
'EdgeCount','PulseWidth','Frequency' measurement types
Counter output subsystem supports:
Rates from 0.1 to 20000000.0 scans/sec
2 channels ('ctr0','ctr1')
'PulseGeneration' measurement type
ans =
ni: National Instruments PCI-6123 (Device ID: 'Dev1') Analog input subsystem supports: 4 ranges supported Rates from 0.1 to 500000.0 scans/sec 8 channels ('ai0' - 'ai7') 'Voltage' measurement type
Digital subsystem supports:
Rates from 0.1 to 10000000.0 scans/sec
8 channels ('port0/line0' - 'port0/line7')
'InputOnly','OutputOnly','Bidirectional' measurement types
Counter input subsystem supports:
Rates from 0.1 to 20000000.0 scans/sec
2 channels ('ctr0','ctr1')
'EdgeCount','PulseWidth','Frequency' measurement types
Counter output subsystem supports:
Rates from 0.1 to 20000000.0 scans/sec
2 channels ('ctr0','ctr1')
'PulseGeneration' measurement type
s =
Data acquisition session using National Instruments hardware: Will run for 1 second (8000 scans) at 8000 scans/second. Number of channels: 1 index Type Device Channel MeasurementType Range Name ----- ---- ------ ------- --------------- ---------------- ---- 1 ai Dev1 ai0 Voltage (Diff) -10 to +10 Volts
data =
-0.1007
Timeout expired before operation could complete.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Hardware Discovery and Setup 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by