Hello,

I am a beginner of the BCI research. I have some questions about the BCI2000 Offline Analysis tool. I am trying to compute the r value by using directly the matlab functions. My aim is to recreate the same plot that I generate with the Offline Analysis tool. The following steps describe what I did:

- I used the StimulusPresentation application to generate 4 training files (.dat);

- I imported one training files in matlab;

- I extracted from the data matrix five matrix (4000samplesX14channels) for every stimulus(just for the motion of the left and right arm);

- I converted every matrix into the frequency domain using the mem file ([spectrum, frequencies] = mem(A(:,:), [16 0 140 2 15 0 2000]) where A is 4000samplesX14channels);

- I computed the average of the five matrix (for every stimulus, so now I have 2 matrix 71binsX14channels );

- I repeated these steps for the other *dat files(I did 4 training session)

- In matlab I created two matrix: left and right related respectively to the motion of the left and right arms. Where left(71,14,trial)=spectrum_left(trial) and right(71,14,trial)=spectrum_right(trial);

- I used calc_rsqu.m (OfflineAnalysis folder) to compute the rsqu value(I have not found the rvalue.m file) [ressq, amp1, amp2] = calc_rsqu(left, right, 1) where the matrix left and right are (71binsX14channelsX4trials) ;

- I displayed it: figure, imagesc(1:71,1:14,flipud(ressq')).

Does this procedure have any sense? My problem is that the image that I display is different from the image that I display using the Offline Analysis tool. Do you have any suggestion?

Sorry if I have not been so clear!

## Offline Analysis

### Re: Offline Analysis

Hi Paola,

from your description, it is not clear how the matrices "left" and "right" are related to the raw data. However, four trials in each of them are too few. You have many more trials in your data.

To compute "left" and "right", first extract each "left" and "right" trial from your data, then apply the mem function to each trial separately, resulting in a "left" and "right" matrix with dimensions 71bins X 14channels X <total number of trials> where "total number of trials" is the total number of "left hand" and "right hand" trials in all your data files, which should be between about 25 and 100. Then, use the calc_rsqu function to compute r^2 values from the two matrices.

If that result doesn't match the output of the Offline Analysis tool, check whether you are calling the mem function the same way as Offline Analysis does.

Regards,

Juergen

from your description, it is not clear how the matrices "left" and "right" are related to the raw data. However, four trials in each of them are too few. You have many more trials in your data.

To compute "left" and "right", first extract each "left" and "right" trial from your data, then apply the mem function to each trial separately, resulting in a "left" and "right" matrix with dimensions 71bins X 14channels X <total number of trials> where "total number of trials" is the total number of "left hand" and "right hand" trials in all your data files, which should be between about 25 and 100. Then, use the calc_rsqu function to compute r^2 values from the two matrices.

If that result doesn't match the output of the Offline Analysis tool, check whether you are calling the mem function the same way as Offline Analysis does.

Regards,

Juergen

### Re: Offline Analysis

Hi Juergen,

Thank you for your response. I follow your instructions (I did some errors!) but the image that I create still does not match that created by the Offline tool. I have two more questions:

- If I use the same data in my analysis and in the offline tool the number of trials (few trials) are the same for both of them. So, should not the images be the same? (Also if I use few trials, just for trying the script).

- Where can I see the parameters that the mem function uses in the offline tool? In the script of the tool the instruction is:

[cur_spectrum,freq_bins]=mem(double(condition2data(cur_start:cur_start+spectral_size, ), parms);

I have not found the parms vector.

Thank you for your patience!!!

Thank you for your response. I follow your instructions (I did some errors!) but the image that I create still does not match that created by the Offline tool. I have two more questions:

- If I use the same data in my analysis and in the offline tool the number of trials (few trials) are the same for both of them. So, should not the images be the same? (Also if I use few trials, just for trying the script).

- Where can I see the parameters that the mem function uses in the offline tool? In the script of the tool the instruction is:

[cur_spectrum,freq_bins]=mem(double(condition2data(cur_start:cur_start+spectral_size, ), parms);

I have not found the parms vector.

Thank you for your patience!!!

### Re: Offline Analysis

Hi Paola,

the parms vector is set in runBasicAnalysis.m, lines 325-326. Its values come straight from the settings chosen in the GUI.

Regards,

Juergen

the parms vector is set in runBasicAnalysis.m, lines 325-326. Its values come straight from the settings chosen in the GUI.

Regards,

Juergen

### Re: Offline Analysis

Hi Juergen,

thank you so much. I will try to solve my problem following your advices.

Regards,

Paola

thank you so much. I will try to solve my problem following your advices.

Regards,

Paola

### Who is online

Users browsing this forum: No registered users and 1 guest