Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

mega_read

mega_read is a Matlab function that reads MEG/EEG data from MEG-EEG files (.lena, .ds .fiff). It returns a header structure, binary data as well as events bad channels and class files information.

It uses C++ libraries (Cmex) compiled for Matlab2009 and further versions of Matlab. Therefore, mega_read is compatible with Matlab2009, not with previous versions of Matlab.

Recent addition (May 2012): you can now read data over selected ranges of channels, frequencies, and time windows. This may allow loading huge files that could not be read at once due to memory limitations.

Before using mega_read, please add '/usr/cenir/matlab/mega_toolbox/mega_IO' to your Matlab Path:

Code Block
matlab
matlab
>> addpath( genpath( '/usr/cenir/matlab/mega_toolbox/mega_IO' ) )

Usage

Code Block
    [ header, binary, bec ] = mega_read(filename, varargin )
Code Block
   ==== Input ====

First argument

  1. filename ( String ) : name of MEEG file,
Code Block

       Second argument
  1. varargin (list of string) : is used if we don't need to read the whole data in the file. see below how it is used
Code Block
  ====  Output ====
Code Block
         header ( structure )     : a structure containing the header information that can be manipulated by the user

         binary ( double )        : data array of the binary values

         bec    (structure)       :  a structure containing events, badChannels and classFile information if specified in varagin

Examples

Code Block

1. read it all

Code Block
   [h, b]= mega_read('/lena13/home_users/users/datalinks/VALIDATION/example_data/lena_data/example_frequency_sensor_datablock_time.lena');
    will return:
  1. Header information in h
  2. A data array in b for binary data

2. sensors selection

Code Block
   [h, b]= mega_read('/lena13/home_users/users/datalinks/VALIDATION/example_data/lena_data/example_frequency_sensor_datablock_time.lena',  'sensor'  ,     'FP1'  ,'FP2' );
    will return:
  1. Header information in h
  2. A data array in b for sensors 'FP1' and 'FP2'
Code Block

3. time selection

Code Block
   [h, b]= mega_read('/lena13/home_users/users/datalinks/VALIDATION/example_data/lena_data/example_frequency_sensor_datablock_time.lena','time'   , '1'  ,  '3'    );
    will return:
  1. Header information in h
  2. Wiki Markup
    A data array in b for a time window of \[1, 3] in second

Code Block

4. frequencies selection

Code Block
   [h, b]= mega_read('/lena13/home_users/users/datalinks/VALIDATION/example_data/lena_data/example_frequency_sensor_datablock_time.lena', 'frequency'  ,     '20'  ,'24' );
    will return:
  1. Header information in h
  2. A data array in b for frequencies between 20 and 24

5. trials selection

Code Block
   [h, b]= mega_read('/lena13/home_users/users/datalinks/VALIDATION/example_data/lena_data/example_frequency_sensor_datablock_time.lena','trial'   , 'trial1'  ,  'trial3'   );

            will return:
  1. Header information in h
  2. A data array in b for trials between 'trial1' and 'trial2'

6. selection in every dimension

Code Block
   [h, b]= mega_read(('/lena13/home_users/users/datalinks/VALIDATION/example_data/lena_data/example_frequency_sensor_datablock_time.lena','trial'   , 'trial1'  ,  'trial3' , 'sensor'  ,  'FP1'  ,'FP2' ,'time' , '1'  ,  '3', 'frequency'  , '20' ,'24');
            will return:
  1. Header information in h
  2. A data array in b
Code Block
               for :
  1. trials :trial1 and trial3
  2. sensors: 'FP1 and 'FP2'
  3. Wiki Markup
    a time window of \[1, 3] in second

  4. frequencies between 20 and 24
Code Block

7. read events,badChannels and ClassFile information

Code Block
    [h, b,e]=mega_read('/lena13/home_users/users/datalinks/VALIDATION/example_data/lena_data/example_header_bin_event.lena','events')
             will return:
  1. Header information in h
  2. A data array in b
  3. events in e extracted from data.event
Code Block

Back

Code Block