How to introduce overlapped windows for online feedback?

Forum for software developers to discuss BCI2000 software development
Locked
soncyme
Posts: 7
Joined: 03 Aug 2009, 06:28

How to introduce overlapped windows for online feedback?

Post by soncyme » 01 Sep 2009, 02:04

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.

mellinger
Posts: 1341
Joined: 12 Feb 2003, 11:06

Post by mellinger » 04 Sep 2009, 08:03

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

soncyme
Posts: 7
Joined: 03 Aug 2009, 06:28

Post by soncyme » 09 Sep 2009, 07:53

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

mellinger
Posts: 1341
Joined: 12 Feb 2003, 11:06

Post by mellinger » 09 Sep 2009, 08:18

You should declare circBuff as "persistent" or "global" to preserve its contents between calls to bci_Process.

soncyme
Posts: 7
Joined: 03 Aug 2009, 06:28

Post by soncyme » 10 Sep 2009, 00:33

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.

Locked

Who is online

Users browsing this forum: No registered users and 0 guests