outputSingleScan() causing errors in R2018b?
Mostra commenti meno recenti
Hi, I am using Data Acquisition Toolbox with National Instrument's 'USB-6221oem' board. My aim is to configure two different sessions, one for handling the Analogue I/O and other for Digital Output in the user interface that I am developing. In R2018b the Data Acquisition Toolbox function 'outputSingleScan(s,data)' is causing errors, this error was not present in R2018a. When I run the code below
% Session for Digital Output
D = daq.createSession('ni');
Dout = D.addDigitalChannel('Dev1','Port0/Line0:4','OutputOnly');
% Session for Analogue Input/Output
A = daq.createSession('ni');
A.Rate = 100000;
Ain = A.addAnalogInputChannel('Dev1','ai0','Voltage');
Ain.TerminalConfig = 'SingleEnded';
Aout = A.addAnalogOutputChannel('Dev1','ao0','Voltage');
% Data for Analogue Output
DataOut = ones(50,1);
% Execution
outputSingleScan(D,[0 0 0 1 0]);
queueOutputData(A,repmat(DataOut,20,1));
DataIn = startForeground(A);
outputSingleScan(A,0);
outputSingleScan(D,[0 0 1 0 0]);
% If successful execution
disp('Done!');
Matlab gives me the error 'The data argument must contain one column for each output channel in the session.' at line 20 which is the line outputSingleScan(D,[0 0 1 0 0]); (3rd last line in above code, this line of code is to send a single output for the session configured for Digital Output). However, when I comment out line 19: outputSingleScan(A,0); (4th last line in above code, this line of code is to send a single output for the session configured for Analogue I/O) the script runs successfully.
It doesn't matter if there are any lines of code between line 19 (output for the session configured for Analogue I/O) and line 20 (output for the session configured for Digital output), the execution always stops when it encounters the outputSingleScan(D,[0 0 1 0 0]); for session configured for Digital output and this line is number given as the error line in the command window. Also, as you can see in the above code if I execute the outputSingleScan(D,[0 0 0 1 0]); function for Digital output Session and then execute the outputSingleScan(A,0); function for Analogue I/O Session then it works fine. The error only occurs when I execute outputSingleScan(D,[0 0 0 1 0]); function for Digital output Session AFTER I have executed the outputSingleScan(A,0); function for Analogue I/O Session.
This problem has been driving me crazy from last 3 days. Do any of you know why this is happening? Thanks for your time and help in advance! :)
6 Commenti
Tom DeLonge
il 8 Mar 2019
I also observed similar bugs, but did not bother investigating further. I returned to Matlab 2018a
Chaitanya Jha
il 15 Mar 2019
Modificato: Chaitanya Jha
il 15 Mar 2019
Tom DeLonge
il 26 Mar 2019
Thank you for letting me know. Do you know whether this bug is fixed in 2019a?
Chaitanya Jha
il 8 Apr 2019
Steven Lord
il 8 Apr 2019
Chaitanya Jha
il 30 Apr 2019
Modificato: Chaitanya Jha
il 30 Apr 2019
Risposte (0)
Categorie
Scopri di più su National Instruments Frame Grabbers in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!