MATLAB Answers

0

Data Acquisition in GUI

Asked by Bohan Wu on 9 Aug 2019
Latest activity Answered by Geoff Hayes
on 13 Aug 2019
Hi,
I wrote the below code into a seperate .m file and it works properly.
s = daq.createSession('ni');
addAnalogOutputChannel(s,'cDAQ1Mod2',0,'Voltage');
s.IsContinuous = true;
s.Rate = 10000;
data = linspace(-1,1,5000)';
lh = addlistener(s,'DataRequired', ...
@(src,event) src.queueOutputData(data));
queueOutputData(s,data)
startBackground(s);
But when I copy these code to a push button callback function in my GUI. It stops generate the signal.
Can anyone help me, soooo appriciated!

  0 Comments

Sign in to comment.

Tags

1 Answer

Geoff Hayes
回答者: Geoff Hayes
2019 年 8 月 13 日

  0 Comments

Sign in to comment.