Import OT BioLab+ EEG data from Matlab .mat

Hey,
I am currently using a bioelletronica OT BioLab+ to reccord my EEG signal and export them in .mat, then when I want to import my EEG data I can not and I have the joined error message..
Where do you think the error comes from ? Do I have to export my data in another way before importing it on Brainstorm ?error message for imort EEG

Thank you by advance,
marie

Hi Marie,

  1. Once you have created the .mat file with the OTBioLab+ software, open it to know the value of the SamplingFrequency variable.

  2. To, import the .mat file in Brainstorm, you need to select EEG: Matlab matrix (*.mat) for the option "File Name".

image

  1. Following the OTBioLab+ documentation, the options to import are:
  • Matrix orientation: [Time x Channel]
  • Uncheck First element = channel name
  • Skip header lines: 0
  • Sampling frequency: Write the value obtained in the Step 1
  • Baseline duration: If there is not baseline write 0.00
  • Number of trials averaged: 1 if trials were not averaged
  • Amplitude units: OTB documentation does not say the units for .mat files, check the imported data to verify the correct units

image

  1. Finally, when asked to "Select the field that contains your EEG recordings", select Data

Thank you for your answer, it helped me but I have still an error message when I want to open it (see the document attached) Do you have a solution for this ? I checked on Matlab and I have all my data there except the data and time are in different matrix, this could be the problem ?error message for imort EEG matrix

Thank you by advance,
Marie

Matlab .mat is not a file format, it is a contained for a list of named variables.
The types of full Matlab structures (= list of variables) that are supported for importing in Brainstorm are the following:

  1. SPM: using file format "MEG/EEG: SPM (.mat/.dat)"
  2. FieldTrip: using file format "MEG/EEG: FieldTrip (.mat)"
  3. EEGLAB: using file format "EEG: EEGLAB (.set)"
  4. Brainstorm: direct copy into the database folder followed by a "Reload" of the folder. The variables must strictly follow the conventions described in the introduction tutorials: https://neuroimage.usc.edu/brainstorm/Tutorials/Epoching#On_the_hard_drive
  5. Matlab matrix: In this case, the matrix must contain only one variable containing the data, in the format [Nchannel x Ntime] or [Ntime x Nchannel], with an optional 3rd dimension for multiple trials. This can't load the time vector simultaneously.
    https://github.com/brainstorm-tools/brainstorm3/blob/master/toolbox/io/in_data_mat.m#L32

If you want to use the options 4 or 5: you need to edit the data structure to write .mat files that can be interpreted correctly by Brainstorm.

Other options are possible:

  • Develop a reader in Brainstorm to import the native file format directly (in_fopen_...m / in_fread_...m) - if you have a lot of files to process, or other colleagues interested by this feature, it could be interesting, but it would require some time investment to write and debug the code
  • Export your data in a more standard file format: maybe .edf?

Thank you,

I tried the 1., 2. and 3. options and it is not working for me, for the 4 and 5 options if I understand it right I should have only one variable with the matrix of all the data, and I think it is what I have in my Data matix (see the 2 document below) when I click on the data table... I manually reccorded this data part alone, and if I try to open it as a Matlab matrix it is working, but I have strange overview of the data (see the document attached) Is there something different I am supposed to do ? Also the time duration is not the same here comapre to the duration on matlab or my real trial.

Unfortunately I cannot export in another format except .csv and .sig, when I tried to open my .csv with brainstorm I also had an error ..

Is the data matrix ok ? Do you have any other advice,

thank you,

Mari

It seems fine, but it's transposed. In the plot you shared, the data is interpreted as "48132 channels with 65 samples each", instead of "65 channels with 48132 samples each".

  • Try to save the Data as a single matrix instead of a cell, and save it in a .mat file.
    DataMatrix = Data{1,1};
    save('your_file.mat', 'DataMatrix');

  • Then import it to Brainstorm with the Option 5: Matlab matrix

Note that DataMatrix is in the [Ntime × Nchannel] shape. And use 2048 Hz as sampling frequency.

Thank you again I did as you suggested and I can import, but I can not display the time series, I have an error as you can see in the attached file, have you an idea why ?

thank you again,

marie

I can not display the time series, I have an error as you can see in the attached file

When you create your subject, select the option "Default channel file: No".
When importing the data, this will create a default channel file with the appropriate dimensions, instead of whatever you've been defining as the channel file in "Common files".

Before you try importing and processing your own recordings, we strongly recommend you start by following all the introduction tutorials (Section "Get started"), and then the EEG/Epilepsy tutorial, both using the example datasets provided. After this reading, you might find it more appropriate to use the menu "Review raw file" rather than "Import MEG/EEG".
https://neuroimage.usc.edu/brainstorm/Tutorials

Ok thank you it is working now, but all my channels data are mimxed, I do not have one line for one EEG electrodes, but I guessed it is something I have to check in channels files or brainstorm channels first ?

Thank you again I will look at the tutorials first,
Marie

What do you mean?

I guessed it is something I have to check in channels files or brainstorm channels first ?

If you have anything to change in the channel file, it would be AFTER linking your recordings to the database.

If you can't make this work, you always have the option to write your own Brainstorm data structures, instead of relying on other supported file formats (option 4).

Thank you again I will look at the tutorials first,

It would save you a lot of time to train properly with the software before trying to use it.