Get data from callback without global variable?

조회 수: 2 (최근 30일)
Matthias
Matthias 2014년 5월 20일
답변: Matthias 2014년 5월 20일
Hi,
I want to continuously acquire data in the background using the Data Acquisition Toolbox as described here. I have a callback function that is called when data is available. This callback can be used to log/process the data.
What is the most elegant/efficient way to make the acquired data available to other functions? Basically, at any point while the acquisition is running in the background, I want to be able to execute commands from the command line such that these commands have access to the data that has just been acquired.
One solution I can think of is to have a global variable in the 'DataAvailable' callback, which I can then access from other functions, but I'm not sure if that's the best solution.
Thanks!

답변 (1개)

Matthias
Matthias 2014년 5월 20일
Any ideas? Are globals the way to go here?

카테고리

Help CenterFile Exchange에서 Simultaneous and Synchronized Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by