Pausing BCI2000 from Matlab using FieldTrip

Forum for software developers to discuss BCI2000 software development
Locked
UCTEEGLab
Posts: 18
Joined: 30 Jun 2011, 09:34

Pausing BCI2000 from Matlab using FieldTrip

Post by UCTEEGLab » 01 Nov 2011, 10:04

Hi

I would like to be able to pause BCI2000 while I am doing some processing in Matlab. For example, if I am running the StimulusPresentation task, I want the process to be paused after one sequence and the next sequence to begin when I tell it to from Matlab.
I have tried doing this using ft_write_event as follows:
event_suspend.type = 'Running';
event_suspend.value = 0;
event_suspend.offset = 0;
event_suspend.duration = 0;
ft_write_event(filename, event_suspend);
This does manage to suspend BCI2000 but I then get a message:
Application: Unexpected Param message.
so I can't change the Running state back to 1.

Also, this seems to suspend BCI2000 and then restart the task - is there any way to just pause it within the same task and then continue from that point instead of starting again?

Thanks
Leandra

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

Re: Pausing BCI2000 from Matlab using FieldTrip

Post by mellinger » 01 Nov 2011, 12:08

Hi Leandra,

are you using a recent version of BCI2000? The "unexpected param message" when setting the "Running" state to 0 should have been fixed long ago.

In order to pause and continue BCI2000 from a state, you will need to modify the application module. In src/shared/modules/application/StimulusTask.cpp, you might change all lines that read

Code: Select all

doProgress = true;
to

Code: Select all

doProgress = State( "MyState");
Also, in the constructor of that class, add a state definition line:

Code: Select all

BEGIN_STATE_DEFINITIONS
 "MyState 1 0 0 0",
END_STATE_DEFINITIONS
This way, you should be able to control BCI2000 by setting the "MyState" state.
Also, in order to interrupt recording to the data file, set the state "Recording" to 0.

Regards,
Juergen

UCTEEGLab
Posts: 18
Joined: 30 Jun 2011, 09:34

Re: Pausing BCI2000 from Matlab using FieldTrip

Post by UCTEEGLab » 02 Nov 2011, 03:54

Thanks for the reply.

I'm using version 3.0.2, which is why I was surprised to see that message because I did read somewhere that it had been fixed.

Thanks for the suggestion about pausing BCI2000, I will give that a try.

Regards
Leandra

Locked

Who is online

Users browsing this forum: No registered users and 3 guests