execute a block of code based on real time analog input

Hey guys,
I am trying to to sychnronize EEG acquisition and visual stimulation so that they achieve time alignment. My EEG equipment can send analog signal through NI device. My thinking is as soon as matlab detected the real time analog signal using the data acquisition toolbox the visual stimulation starts. I've writen the visual stimulation, but I have no idea how to execute it based upon the real time analog input. I believe the next step should be for matlab to monitor the real time analog signal continuously. How can I do that, and how can I use it as an event trigger to execute code?

답변 (1개)

Brahmadev
Brahmadev 2024년 5월 17일

0 개 추천

As per my understanding, you would like a plot to update based on real-time data acquired from your NI device. You can read the data in chunks inside a while loop and update the plot between each read. You can refer to the following example that does exactly that:
The size of data read at once can be changed by editing the while loop and the plot can be refreshed faster or slower as per need.
Hope this helps!

카테고리

도움말 센터File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2021년 9월 27일

답변:

2024년 5월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by