Calculate the memory size the acquired data takes

1 view (last 30 days)
Here is a simple data acquisition code:
ai=analoginput('winsound');
addchannel(ai,1);
rate=setverify(ai,'SampleRate',8000);
set(ai,'SamplesPerTrigger',8000);
set(ai,'TriggerType','Immediate');
1. daqmem(ai);
start(ai)
2. daqmem(ai)
stop (ai)
delete ai
clear ai
*1. daqmem(ai): I execute daqmem here, I get:
winsound0-AI
UsedBytes = 30.00 KB
MaxBytes = 1024.00 MB
2. daqmem(ai): I get:
winsound0-AI
UsedBytes = 16.00 KB
MaxBytes = 1024.00 MB*
UsedBytes =30.00KB, what used the memory?
UsedBytes = 16.00 KB, I know it is acquired data, but the totoal number is 8000, which is double type, how to correspond 8000 to 16 KB?

Answers (1)

Walter Roberson
Walter Roberson on 12 Apr 2014
As speculation: before you have done the start() the internal buffer would be the default, which might be 30 KB. In some ways it makes sense to delay re-sizing the buffer until the next start(), just in case the buffer gets resized yet again (e.g., more channels added.)
winsound normally works internally at 16 bits (2 bytes) per channel, so 8000 samples corresponds to 16000 bytes.
  1 Comment
xiaobo wu
xiaobo wu on 14 Apr 2014
I am using Dataq hardware DI-148U for data acquisition. I also get the data with 16 bits (2 bytes). Is it feasible to exchange 16 bits and 32 bits? Thank you

Sign in to comment.

Categories

Find more on Simultaneous and Synchronized Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!