[Eeglablist] readbdf - big data set - convert to single?

Chris Bishop cwbishop at ucdavis.edu
Wed Aug 29 11:01:53 PDT 2012


Hi Davide,

I think the data are typically stored in the EEG.data field with single
precision.  Unfortunately, I don't have a dataset handy to check that.  To
verify, type "isa(EEG.data, 'single')" at the command line.

I've run into similar problems with very large data sets (e.g., when
recording auditory brainstem responses from 10 channels...we record data at
>16,000 Hz for several hours, so loading those data all at once is nearly
impossible).  My solution was to write a function called "bdf_ChanOps"
which will allow you do any arbitrary mathematical operation on your data
in the BDF format (which requires only that you read in 1 sec of data at a
time).  The output is saved to a new BDF, which can, for instance, have
only the channels you are interested in....I use it often to remove
channels from a BDF or combine them (average) into a single new channel.
 It's been pretty handy.  If you're interested in this, let me know and
I'll send it to you.

-Chris

On Wed, Aug 29, 2012 at 12:49 AM, Davide Baldo <davidebaldo84 at gmail.com>wrote:

> Dear all,
>
> Lately I have been working with an EEG dataset containing 64 channels
> (sampling rate: 2048Hz, Biosemi data).
> When importing the data into Matlab (via pop_readbdf function) I
> experience two problems:
>
> 1. It takes a lot of time to load and afterwards the pc became extremely
> slow (I assume that is because of the huge amount of  RAM needed)
> 2. Sometimes the pc run out of memory
>
>
> Thus I have modified the readbdf function, converting the EEG data from
> double to single precision (each value occupies 4 bytes instead of 8 bytes):
>
>    ...
> (line 100)   catch,
>            warning backtrace off;
>            warning('Warning: file might be incomplete');
>            Records(nrec:end) = [];
>            DAT.Record(RecLen*length(Records)+1:end,:) = [];
>            S(nrec:end,:) = [];
>            break;
>        end;
>
>  (line 109)  end;
>
> %%%%%%% START DAVIDE MODIFICATION %%%%%%%%
>
> >>>>>>>     DAT.Record = single(DAT.Record); <<<<<<< CONVERTING THE EEG
> DATA FROM DOUBLE TO SINGLE
>
> %%%%%%% END DAVIDE  MODIFICATION  %%%%%%%%
>
>
> if rem(Mode,2)==0 % Autocalib
> DAT.Record=[ones(RecLen*length(Records),1) DAT.Record]*EDF.Calib;
> end;
>
> DAT.Record=DAT.Record';
>
> ...
>
>
> This way the data importing is much faster. The question is: Do you think
> I can have any problem because of converting EEG data from double to single
> precision?
>
>
> Thanks a lot,
>
>
> Davide.
>
> _______________________________________________
> Eeglablist page: http://sccn.ucsd.edu/eeglab/eeglabmail.html
> To unsubscribe, send an empty email to
> eeglablist-unsubscribe at sccn.ucsd.edu
> For digest mode, send an email with the subject "set digest mime" to
> eeglablist-request at sccn.ucsd.edu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sccn.ucsd.edu/pipermail/eeglablist/attachments/20120829/3709c12d/attachment.html>


More information about the eeglablist mailing list