Trying to acquire Data using the data acquisition tool and setting the rate leads to the ScansAvailableFcn not running enough times.

3 Ansichten (letzte 30 Tage)
I am creating an app in app designer and am using the data acquisition toolbox. I for the app I need to change the rate of the data acquistion using the "Rate" variable but, the number of data points that is collecting per trigger cannot be in decimals and but be a positive integer (understandably). For example I am trying to collect at 2048Hz ("Rate") and the number of scans per trigger can only be set to 205 or 206 and will try to get triggered 10 times. With either of these it ends up going to 0.9s of a 1.0s trial but there are not enough points of data for the trigger to trigger the final 0.1s of data collection. I have also tried to chagnge the ScansAvailableFcnCount within the trigger after the 9th run but that does not seem to work either? I am not 100% if I did it correctly but I did try the best I could. When I have tried to change the number of scans (points of data) that it collects per trigger It will just set it back to the closet one that the selected "Rate" would automatically set it to(either 205 or 206). Does anyone have any solution for this problem?
The "Rate" variable needs to be able to be equal to anything from 120-2048 but I am currently just trying to figure out how I can get the ScansCallback to read in the last couple hundred points of data.
Any and all help is greatly appreciated!
Thanks!
I took the follow picture from the 9th run of the trial
  1 Kommentar
Connor
Connor am 6 Mai 2024
ended up realizing my start was based around time rather than number of scans. Still have some rounding errors but overall have a much better idea

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Mario Malic
Mario Malic am 7 Mai 2024
Hey,
Rate cannot be any number, it is predetermined by components (hardware) inside the acquisition system. In the manual, you can find exactly what it can be. Even though you set it on a different number, the closest available sampling rate will be used (you won't even get a warning for that).
You can determine the time it takes you to acquire exact number of samples, add a little bit extra just to make sure you capture everything and then discard the samples that you don't need.
You can also use property NumScansAcquired to stop the acquisition.

Produkte


Version

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by