MATLAB: What does this error mean? “Error SOPEN (GDF/EDF/BDF)-W: PhysMin(8) does not fit into header”

edfeeglabphysminsopen

Dear all,
Hereby I'd like to ask your insight on what the following error means:
"Error SOPEN (GDF/EDF/BDF)-W: PhysMin(8) does not fit into header".
The error occurs when I use the pop_writeeeg function from the EEGlab toolbox, to save an eeglabset as edf. I have used the pop_writeeeg function multiple times without any issues/errors, however from time to time I get the abovestanding error (for different EEG datasets). I understand that the number (8) refers to the 8th channel of my EEG data, however, I haven't figured out entirely what PhysMin means/what kind of data it exactly refers to. I'm suspecting that the error occurs when the EEG signal seems to be very noisy for this channel. The result/consequence of the error is that the data for this channel (of channel 8, in this example) won't be saved into my edf file.
I have looked up the sopen function (please see attached), of which I receive the error message. The PhysMin seems to be a character vector, if I'm not mistaken (line 1707 of the sopen function: sPhysMin=char(32+zeros(HDR.NS,8));) ). However, I don't see why/how the size of the vector would vary between channels, and why PhysMin wouldn't fit into the header for this channel. I have limited knowledge on format conversions, so it would be great if anyone could clarify the answer to my question!
Thank you in advance for your helping out,
Christa

Best Answer

To whom it might be useful in future: I've figured it out myself by now - if the EEG signal gets really noisy/drifts a lot then it exceeds the min/max limits of the edf file format (which, as a consequence, makes a flat line of the signal for the entire recording for that channel (not just for the bit where the signal is noisy)). Converting the file to .gdf instead of .edf did the trick, this can be done by using the popwrite_eeg (eeglab) function as well
Related Question