How to increase ScansAvailableFcnCount when using MATLAB to control NIDAQ

조회 수: 21(최근 30일)
Shengjie Gao
Shengjie Gao 2020년 9월 7일
답변: Noah Rubin 2021년 3월 3일
Hey guys,
I am currently trying to use MATLAB to control a NIDAQ (usb-6255) to collect data from my sensor. I want to do real-time plotting while collection the data.
I understand it is a good idea to use a callback function to do the plot like this
dq.ScansAvailableFcn = @(src,evt) plotDataAvailable(src, evt);
I just notice the default ScansAvailableFcnCount is set to a value that the plotting function above will be called 10 times a second (10Hz). My question is: Is there any way to increase the frequnency? I found it is easy to increase the ScansAvailableFcnCount so that the plotting function can be called less than 10Hz. However, when I decrease this value below 0.1*dq.Rate, it will say (here dq.Rate=300)
At the specified rate, the minimum count
allowed is 31.
Thank you very much!


Noah Rubin
Noah Rubin 2021년 3월 3일
Hi Anmol,
Thank you very much for your reply!
To clarify though, the only issue that is actually preventing us from sampling at a higher rate is the fact that we we have:
Fs = 3000;
dq.Rate = Fs;
nSamples = 0.02*Fs;
dq.ScansAvailableFcnCount = nSamples;
Given that Shengjie, Mauro, and Agostina all had the exact same issue as well-- a 10 Hz read limit exactly for everyone involved in this thread-- I do not believe this is an issue arising from our own use case. Unless I am misinterpreting line 1514 in my earlier screenshot, the 10 Hz limit is being set within the source code itself.
Given that we also have our setup working perfectly with the old toolbox, this convinces me further of that possibility.
If you have any other information, it would be greatly appreciated. I am happy to contact technical support if needed.
Thank you again for your time!

Anmol Dhiman
Anmol Dhiman 2020년 9월 13일
Hi Shengjie,
Refer to link under Set ScansAvailableFcnCount to change the value for ScansAvailableFcnCount.
Anmol Dhiman
  댓글 수: 7
Anmol Dhiman
Anmol Dhiman 2021년 3월 3일
Hi Noah,
This seems to be very specific use case. This might need more follow up and discussions, hence I suggest you to contact Technical Support.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by