- acquires data from a DAQ device or sound card
- displays a live view of acquired data
- logs acquired data to a MAT file
Acquiring and plotting continuous NI data doesn't work within app Designer. Please help.
4 次查看（过去 30 天）
My code for acquiring and plotting live data works well outside the app Designer. However, i would like to include it in an App where it is executed by pushing a button from the user.
This is my code:
devices = daq.getDevices
s = daq.createSession('ni')
%abtastrate in Hz und Aufnahmedauer
s.Rate = 1000
s.DurationInSeconds = 5
% plottet soblad fesstgelegte Anzahl an Datenpunkten generiert ist
s.NotifyWhenDataAvailableExceeds = 10
lh = addlistener(s,'DataAvailable',@(src,event) plot(event.TimeStamps, event.Data))
This works well so far. But if i integrate it in a buttonpushed callback function within app Designer it doesn't work. Also it doesn't work if i try to plot it in UIAxes by adding plot(app.UIAxes, event.TimeStamps, event.Data)
Any help would be much appreciated. Thank you, Marvin
Andrei Ursache 2018-8-8
Can you refer to "Data Acquisition Live" app, which can be downloaded from File Exchange.
This example app shows how to use Data Acquisition Toolbox and App Designer to build an app which: