Exporting Data from Matlab to BESA Statistics

From BESA® Wiki
Jump to: navigation, search

Introduction

This is a short tutorial on how to export MEG data from Matlab in a file format readable by BESA Statistics. For the purpose of this example, MEG data is used, however, the case of EEG data should not be very different. As an example the standard structure generated by FieldTrip after time-lock analysis is used (ft_timelockanalysis(...)) with the option

cfg.keeptrials = 'yes';
.

The structure looks like this:

timelock_cond1 = 
 
          avg: [147x475 double]
          var: [147x475 double]
         time: [1x475 double]
          dof: [147x475 double]
        label: {147x1 cell}
        trial: [100x147x475 double]
       dimord: 'rpt_chan_time'
         grad: [1x1 struct]
    trialinfo: [100x1 double]
          cfg: [1x1 struct]

The matrix 'avg' contains the averaged data for the current condition and the matrix 'trial' contains the single trial data. In this case there are 100 trials, the data contains 147 channels (this is a 148 channels BTI system but 1 channel was defined as bad) and 475 time samples. An important substructure is 'grad', it contains the positions of the MEG channels.