How to buffer a certain amount of data in a buffer without saving all the data that passes through it?

조회 수: 6 (최근 30일)
I have two approaches. The problem with the one in the zip file is that it is saving all the values everytime they pass to the matrix. I dont want to save them. I just want to process them and save just the ones that I am interested in.
The second approach has a problem when extracting the data out it. Its not extracting 1000 values is creating an array of arrays. The first point is repeated 1000 times, then second point 1000 and so on. Its a ring buffer.
Hope you can help me find a solution to it.
The idea is to process 20 sec = 1000 samples filter and process them and just save the data that I am interested in.

답변 (1개)

Puru Kathuria
Puru Kathuria 2021년 1월 3일
You can try using a FIFO buffer (dsp.AsyncBuffer).
  1. Initialise the buffer of the appropriate size/capacity
  2. read data in a sequential manner and write to the buffer
  3. then read the buffer and do further processing
Example:
windowLength = 10;
dataBuff = dsp.AsyncBuffer(windowLength);
for iterator = 1:10
data = dataSource();
write(dataBuff, data);
%do further processing with this data
dataToFurtherProcess = read(dataBuff);
end
You can also try using dsp.SignalSource to create a real time streaming source.
Refer to this part of the example to see a similar buffer usage.

카테고리

Help CenterFile Exchange에서 Signal Attributes and Indexing에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by