How should I do to realize to acquire data at faster rate?

6 views (last 30 days)
I would like to call listener and acquire analog signals with NI-DAQ at faster rate <100 ms continuously.
For example, I setted a scan rate to 250k/scans (this is a muxmum rate of my NI-DAQ) and a value of ScansAvailableFcnCount to 2500 to acquire data by every 10 ms. However, a following error occured: "At the specified rate, the minimum count allowed is 25000". I guess this message indicates that I can only acquire data by 100 ms or longer duration.
Previous version (MATLAB 2019b), I can set data available counts setting a property, NotifyWhenDataAvailableExceeds. However, the use of DataAvailable is not recommended for latest version.
How should I do to realize to acquire data faster?
  1 Comment
Andrew Brown
Andrew Brown on 20 Jul 2021
Have you figured out a solution to this problem? I am encountering the same issue. I want to refresh a plot with new data brought in by the callback function at least 30 times per second, but it seems 10 times per second is the max, which is not fast enough for smooth live plotting.

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 22 Jul 2021
It is not that the NotifyWhenDataAvailableExceeds is not recommended, it is that the entire session interface approach has been replaced with the DataAcquisition interface. This started with release R2016a (I believe).
You can see an example that compares session interface code with dataacquisition interface code using this feature here:
Once your code is transitioned to the DataAcquisition interface, it looks like the new functionality is named ScansAvailableFcnCount.
If instead you are sticking with the session interface approach, then you will still need to use NotifyWhenDataAvailableExceeds.
  1 Comment
Andrew Brown
Andrew Brown on 22 Jul 2021
I use the new syntax calling the scansAvailableFcn and setting scansAvailableFcnCount. I am taking data at 100kHz and I get an error if I try to call the callback function any more often than every 10k scans (10 times per second) which makes updating a live plot at more than 10Hz impossible. The new syntax does not fix this problem unfortunately.

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!