Memory leak while acquiring data with NI DAQ USB device (Matlab 2020b)

Now I am acquiring analog input data by NI USB-6255.
I am facing a memory leak which cannot be released with flush nor with reset.
I conduct 42 ch single-ended voltage measurement with external scan clock and start trigger. The duration of the measurement is 7000 seconds and the data is read every 0.5 seconds as follows;
>> [trg,idx]=addtrigger(dq,"Digital","StartTrigger","External","Dev1/PFI1");
>> [clc,cdx]=addclock(dq,"ScanClock","External","Dev1/PFI0");
>> [fid1,message]=fopen('logfile.bin','w+');
>> start(dq,"Duration",7000);
>> while dq.NumScansAcquired < 1000 * 7000
>> if dq.NumScansAvailable >= 1000 * 0.5
>> [data,timestamps,~] = read(dq,seconds(0.5),"OutputFormat","Matrix");
>> fwrite(fid1,[timestamps,data]','double');
>> end
>> end
>> [data,timestamps,~] = read(dq,seconds(0.5),"OutputFormat","Matrix");
>> fwrite(fid1,[timestamps,data]','double');
>> flush(dq);
>> stop(dq);
The memory usage grows up during the while-loop and not released after the flush nor the stop, which results in memory error in Matlab.
I am very glad if you kindly show me how to avoid it.
Cheers,

1 commentaire

I'm having the same issue. NumScansAcquired keeps increasing and I can't reset it or disable it. Have you found any solution?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Data Acquisition Toolbox dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by