Difference between revisions of "Exporting Data from Matlab to BESA Statistics"
Line 26: | Line 26: | ||
== Exporting procedure == | == Exporting procedure == | ||
Let us assume that we already have the data for one subject and two conditions (cond1 and cond2) in these two structures: <tt>timelock_cond1</tt> and <tt>timelock_cond2</tt>. | Let us assume that we already have the data for one subject and two conditions (cond1 and cond2) in these two structures: <tt>timelock_cond1</tt> and <tt>timelock_cond2</tt>. | ||
+ | === Exporting single trial data as ascii-vectorized files (.avr) === | ||
+ | For the export of the single trial data in an .avr-file format we need the function <tt>besa_save2Avr(...)</tt> which is contained in the zip-file mentioned above. |
Revision as of 10:37, 8 April 2016
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. In order to be able to follow the steps in this tutorial you need to download the scripts for exporting data from Matlab to BESA here: [1].
Exporting procedure
Let us assume that we already have the data for one subject and two conditions (cond1 and cond2) in these two structures: timelock_cond1 and timelock_cond2.
Exporting single trial data as ascii-vectorized files (.avr)
For the export of the single trial data in an .avr-file format we need the function besa_save2Avr(...) which is contained in the zip-file mentioned above.