Mat to gdf,edt,bci2000dat

Locked
eelamin
Posts: 9
Joined: 19 Jun 2010, 09:00

Mat to gdf,edt,bci2000dat

Post by eelamin » 19 Jun 2010, 09:08

Hello

I am experiencing problem in converting eeg signal in the format .mat
into any format that supported by the bci2000 offline analysis toolbox
I will be pleased if someone help me

Elgasim

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

Post by mellinger » 21 Jun 2010, 06:46

In order to save data as a BCI2000 data file, you will need to provide parameter and state (event, trigger) information in a suitable format, and then use the save_bcidat mex file to write out the file.

Could you give more information about what you want to do?

--Juergen

eelamin
Posts: 9
Joined: 19 Jun 2010, 09:00

Post by eelamin » 24 Jun 2010, 11:51

can you tell me more about the parameters and triger events and how can i add it to the data?

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

Post by mellinger » 25 Jun 2010, 08:38

What kind of data do you have? Sensorimotor rhythms, or evoked potentials?

eelamin
Posts: 9
Joined: 19 Jun 2010, 09:00

Post by eelamin » 25 Jun 2010, 11:07

My data is berlin bci competition IV data set one "(seven subjects imagining three types of movement right hand, left hand, and leg movement) utilizing motor imagery

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

Post by mellinger » 25 Jun 2010, 12:33

You will need to specify target conditions for each point in time. Create a struct variable "states" with a member "StimulusCode" in Matlab, which is a N x 1 matrix. It should have as many entries as there are samples in the data set. For each point in time, assign a StimulusCode of 0, 1, 2, or 3, depending on which imagination was performed at that point in time:
  • 0 when no imagination was performed,
    1 when right hand movement was imagined,
    2 during left hand imagination,
    3 during leg movement imagination.
In addition, you need to specify the sampling rate as a BCI2000 parameter. In Matlab, create a struct variable "parameters", with a member "SamplingRate", which is itself a struct, with the following fields (replace the number in the Value field with the actual sampling rate):

Code: Select all

>> parameters.SamplingRate

ans = 

         Section: 'Source'
            Type: 'int'
    DefaultValue: '256Hz'
        LowRange: '1'
       HighRange: ''
         Comment: 'sample rate'
           Value: {'600'}
    NumericValue: 600
Assuming that the EEG signal is contained in a variable called "signal" with dimensions channels x samples, run the following command:

save_bcidat('myfile.dat', signal, states, parameters);

The resulting file should be suited for use with the BCI2000 OfflineAnalysis program.

eelamin
Posts: 9
Joined: 19 Jun 2010, 09:00

Post by eelamin » 01 Jul 2010, 02:50

I had constructed the structures states,parameters with their substructures stimuluscode, samplingrate respectively but,when using the command:
save_bcidat('myfile.dat', signal, states, parameters);
returns:
??? Error using ==> save_bcidat
Parameter values must be strings or cell arrays of strings.

and when i convert the parameters.sampling rate into cell using the command:
struct2cell
it returns:
??? Error using ==> save_bcidat
Could not access string field "Section".
would yu help me please

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

Post by mellinger » 01 Jul 2010, 08:33

Did you enclose the parameter value into curly braces as in

Code: Select all

parameters.SamplingRate.Value = {'600‘}
?

eelamin
Posts: 9
Joined: 19 Jun 2010, 09:00

Post by eelamin » 01 Jul 2010, 08:46

yes i wrote the code:
SamplingRate= struct('Section','Source','Type','int','DefaultValue','256Hz','LowRange','1','HighRange','','Comment','sample rate','Value',{'100'},'NumericValue','100');

eelamin
Posts: 9
Joined: 19 Jun 2010, 09:00

Post by eelamin » 02 Jul 2010, 00:50

yes i wrote the code:
SamplingRate= struct('Section','Source','Type','int','DefaultValue','256Hz','LowRange','1','HighRange','','Comment','sample rate','Value',{'100'},'NumericValue','100');
but, the problem is still running

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

Post by mellinger » 02 Jul 2010, 08:29

When you write

Code: Select all

parameters.SamplingRate
what does the output look like?

eelamin
Posts: 9
Joined: 19 Jun 2010, 09:00

Post by eelamin » 02 Jul 2010, 17:25

the code looks like:
>> parameters.SamplingRate

ans =

Section: 'Source'
Type: 'int16'
DefaultValue: '256Hz'
LowRange: '1'
HighRange: ''
Comment: 'sample rate'
Value: '{100}'
NumericValue: '100'


and when using the command struct2cell it looks like;
>> parameters.SamplingRate

ans =

'Source'
'int16'
'256Hz'
'1'
''
'sample rate'
'{100}'
'100'

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

Post by mellinger » 05 Jul 2010, 08:27

Look at the curly braces in the "Value" field. The field should read {'100'} but it reads '{100}'. Once you correct this, it should work.

Locked

Who is online

Users browsing this forum: No registered users and 0 guests