Mixed sampling rate error when reviewing raw EDF format data in Windows 8

Dear Brainstorm experts

I have problems in importing the processed ERP data in the brainstorm in the EDF format using the Review Raw File function.

It reported ‘File with mixed sampling rate is not supported…’ when I tried to load the data in.

However, it only happened when I tried to do it in the Matlab under the Windows 8 environment. (Matlab 2014b 64 bit; Matlab 2010a 64bit)

When I use the lab computer it works normally. (Matlab 2014a 64 bit; Matlab 2009a 32bit)

I found similar a bug which has been solved around 2012. Could you please provide some clues how to have this problem solved, because I will have to leave the lab and work on my own PC for a while.

Best

Oscar

Hi Oscar,

Some low level functions of Matlab (fopen, fread, fseek) behave in a slightly different way on different systems.
Those problems are sometimes difficult to debug, because they are hard to reproduce.

I can try to dig into this but I would need some example datasets.
Can you upload somewhere (eg dropbox) a dataset that consistently crashes on your computer?
Then send send me the link in a separate email (click on my user name on this forum).

Thanks,
Francois

Hi Francois

Thanks so much for your reply! I have sent you a link for the data.

Best wishes

Oscar

Hi Oscar,

Your file is not saved correctly. The number of samples is missing for electrodes 36 to 63.

I added a quick fix in the reading function: when the number of samples is not defined for one channel, we use the same as the previous channel.
It should fix your problem now, but you should report this issue to the developers of the programs that saved your EDF file.

The update is online. Please update Brainstorm and try again (menu File > Update Brainstorm).

Cheers,
Francois

Hi Francois

First, thank you so much for checking this problem!

I have tried the new function (Win8.1; Matlab2014b 64bit), BST indeed read the EDF file but half of the channels were not read at all.

In the commond window I saw the messages as below.

EDF> ERROR: File is truncated (155 time samples were read instead of 256). Padding with zeros…
EDF> The number of samples is not specified for channel “O1”.
EDF> The number of samples is not specified for channel “Oz”.
…(here similar messages for different channels are omitted)
EDF> ERROR: File is truncated (155 time samples were read instead of 256). Padding with zeros…

I used the same dataset that I sent to you. However, at least BST is reading EDF format data now on my own laptop!

Cheers,

Oscar

Hello,

The file is completely corrupted. There is information missing in the header of the file (number of samples) and the recordings themselves (not all the information declared in the header is available in the file).
I recommend you fix your files and/or the program that generates them before trying to use them for anything.

Francois

Hi Francois

Thank you very much for explaining everything! It is really strange that the data once can be used suddenly became corrupted. I could not even use it in my lab computer. The software I used for preprocessing is Brain Vision Analyzer 2.1. I will try to contact them for this error.

Thanks very much again!

Oscar