MATLAB Answers

Data Acquisition in GUI

10 views (last 30 days)
Bohan Wu
Bohan Wu on 9 Aug 2019
Answered: Geoff Hayes on 13 Aug 2019
I wrote the below code into a seperate .m file and it works properly.
s = daq.createSession('ni');
s.IsContinuous = true;
s.Rate = 10000;
data = linspace(-1,1,5000)';
lh = addlistener(s,'DataRequired', ...
@(src,event) src.queueOutputData(data));
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!

Answers (1)


Community Treasure Hunt

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

Start Hunting!