How to produce an immediate trigger in session-based continuous collection mode
5 ビュー (過去 30 日間)
古いコメントを表示
Hello all,
I have a collection paradigm in the MATLAB Session-based interface where I want to collect data continuously, then once a certain condition of the incoming data has been met, a digital output changes to produce a trigger. So, I setup a background collection in continuous mode with two listeners. The first listener is the dataAvailable listener, which concatenates the incoming data, plots it, and also checks for the condition. If the condition is met, this listener will queue different data to the digital output with queueOutputData to produce the trigger. The second listener is just a dataRequired listener, so when the number of samples in the queue drops below a threshold, this listener is called, which queues up more data.
When this program is run, it doesn’t behave like I want it to. Specifically, when the condition is met and it comes time to output the trigger, it doesn’t output it immediately. This makes some sense, since there will always have to be data in the queue for the collection to continue, so when the trigger data is queued, it has to “wait its turn in line” before getting outputted. However, the amount of time before the trigger is actually displayed at the output is much longer than expected from the number given by scansQueued. It looks like MATLAB automatically updates the queue with extra data that neither of the listeners have queued up. From what I can understand, either MATLAB is not reading the amount of data in the queue like I expect it to, or it is repeatedly queuing up the same data for some reason.
- Has anyone else run into similar problems with the queue and with scansQueued?
- Is there a better way to do what I am trying to do (continuous collection that immediately changes the output with a condition)? Perhaps without using the queueOutputData functionality?
- Or could there be a way to overwrite the queue so that I can immediately output desired data?
Attached is the code I am working with. I am currently working in version 2015a.
Thanks for your time.
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Debugging and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!