Page 1 of 1

How to introduce overlapped windows for online feedback?

Posted: 01 Sep 2009, 02:04
by soncyme
For the online MATLAB-engine based feedback experiment, it is possible to choose the buffer size, and update the position of the flying ball. But what I want is to update, for example, every 0.5 second, with the window length of 1 second; which means 0.5 second overlapped windows.

Can anyone tell me how to introduce this?
Thanks in advance.

Posted: 04 Sep 2009, 08:03
by mellinger
You will need to set SampleBlockSize to the equivalent of 0.5 seconds, and introduce your own 1-second buffer on the Matlab side, appending each incoming data block at the end of the buffer, and removing the first 0.5 seconds from the buffer.

HTH,
Juergen

Posted: 09 Sep 2009, 07:53
by soncyme
Hi, thanks for your answering.
I set the SampleBlockSize to 64 with sampling frequency 256 Hz, which means 3/4 seconds overlapped. Then in the function bci_Process,
I wrote :
buffSize=256;
circBuff=zeros(5,buffSize);
circBuff=[circBuff in_signal];
circBuff(:,1:64)=[];

but the first 192 points of circBuff are always zero.

Then I added a global variable named temp equal to zero in bci_Initialize,
and the codes in bci_Process changed to the below

global temp;

buffSize=256;
if temp==0
circBuff=zeros(5,buffSize);
else
circBuff=[circBuff in_signal];
circBuff(:,1:64)=[];
end

temp=1;

and the end of the function I let temp equal to zero again.
But this produced the same result.

Could you tell me where I went wrong?

Thanks a lot!




mellinger wrote:You will need to set SampleBlockSize to the equivalent of 0.5 seconds, and introduce your own 1-second buffer on the Matlab side, appending each incoming data block at the end of the buffer, and removing the first 0.5 seconds from the buffer.

HTH,
Juergen

Posted: 09 Sep 2009, 08:18
by mellinger
You should declare circBuff as "persistent" or "global" to preserve its contents between calls to bci_Process.

Posted: 10 Sep 2009, 00:33
by soncyme
Hi, thank you very much!
I found that by declaring circBuff as the global variable, the problem is solved .
Thanks again!
mellinger wrote:You should declare circBuff as "persistent" or "global" to preserve its contents between calls to bci_Process.