Acquiring and plotting continuous NI data doesn't work within app Designer. Please help.

1 vue (au cours des 30 derniers jours)
Marvin Zedler
Marvin Zedler le 18 Jan 2018
Commenté : Andrei le 11 Juin 2019
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:
if true
devices = daq.getDevices
%session erstellen
s = daq.createSession('ni')
addAnalogInputChannel(s,'DEV1',0, 'Voltage')
%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))
s.startBackground();
end
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

Réponses (1)

Andrei
Andrei le 8 Août 2018
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:
  • acquires data from a DAQ device or sound card
  • displays a live view of acquired data
  • logs acquired data to a MAT file
  2 commentaires
han xiao
han xiao le 11 Juin 2019
Hello Mr.Ursache,
My name is Han. I`m a user of data acquisition toolbox and doing tests with live vibration signal. Your app design is very cool and useful, but still I have no idea on how to create a standalone application and deploy it on the target machine (without MATLAB installed).
That would be very kind of you, if you may give me some help. I`m very grateful!
Kind Regards
Han Xiao
Andrei
Andrei le 11 Juin 2019
Han Xiao, you can use MATLAB Compiler to build a standalone executable app from an app created with App Designer.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by