Data structur

Christian Hesse c.hesse at FCDONDERS.RU.NL
Tue Mar 20 12:12:42 CET 2007


Hi Shantanu,

> It took me sometime to figure out the dtaformat, so I prepared the
> format
> like this using a .MAT file and some synthetic data like this
>
> data = [];
> data.fsample = 115.3402;
> data.label = {'FP1'; 'FP2'; 'Fz'; %presently using only 3 channels
>      %'F3'; 'F4'; 'F7'; 'F8'; ...
>      %'T3'; 'T4'; 'T5'; 'T6';...
>      %'P3'; 'P4'; 'Pz'; 'O1'; 'O2'; 'Oz';...
>      %'C3'; 'C4'; 'Cz'; 'A1'; 'A2'; 'EKG'};
>
> data.nTrial=3;
>
> trial1 =
> [[1.1;1.2;1.6;6.7;7.2],[1.5;1.9;1.8;1.2;1.1],[1.5;1.9;1.8;1.2;1.1]];%
> other channel data to be added here
> trial2 =
> [[2.9;2.2;2.3;2.4;2.2],[7.5;7.9;7.8;7.2;7.1],[1.5;1.9;1.8;1.2;1.1]];
> %sllrly,
> other channel data to be added here
> trial3 =
> [[1.1;1.2;1.6;6.7;7.2],[1.5;1.9;1.8;1.2;1.1],[1.5;1.9;1.8;1.2;1.1]];
> %sllrly,other
> channel data to be added here
>
> time1 = [1,2,3,4,5];%and here
> time2 = [.1,.2,.3,.4,.5];%and here
> time3 = [1,2,3,4,5];%and here
>
> %Is there another way to do this as the same time axis is there for
> all
> channels?

The FT data structure assumes that there is one time axis for each
trial which is the same for all channels. In your case it may even be
the same time axis on all trials, however, this is a) not the general
case and b) a trial time axis is required later on for averaging and
spectral analysis to make sure the data epochs on different trials
are correctly aligned over trials.

>
> data.trial = cell(data.nTrial,1);
>
> data.trial{1,1} = trial1 ;
> data.trial{2,1} = trial2 ;
> data.trial{3,1} = trial3 ;
>
> data.time = cell(data.nTrial,1) ;
>
> data.time{1,1} = time1;
> data.time{2,1} = time2;
> data.time{3,1} = time3;
>
> data
>
>
> Gives the output
>
> data =
>
>     fsample: 115.3402
>       label: {23x1 cell}
>      nTrial: 3
>       trial: {3x1 cell}
>        time: {3x1 cell}

This is the correct format (except that in FT there is no "nTrial"
field);


> If this is ok, then why am I getting error when I run it for FT?
>
>>> read_fcdc_data(data);
> ??? Function 'exist' is not defined for values of class 'struct'.
>
> Error in ==> exist at 41
>   [varargout{1:nargout}] = builtin('exist', varargin{:});
>
> Error in ==> fieldtrip\private\read_data at 70
> if ~exist(filename)
>
> Error in ==> read_fcdc_data at 49
> [dat] = read_data(varargin{:});

If you look at the function definition (interface) for READ_FCDC_DATA
you will see that it expects a sting argument (i.e. a filename) as
input since it is used to read data from data files with known
format. The error is generated because Matlab is trying to determine
whether your input "data" refers to an existing file in the system,
which of course it does not.

Since the data format you are using is not known to FT, you cannot
use any of the READ_FCDC_XXXX (or lower level) functions. Instead,
you have to read your data into an FT data structure yourself, as you
now seem to have done successfully.

Once you have the data structure, you just pass it to the different
analysis functions like TIMELOCKANALYSIS or FREQANALYSIS.

I hope this  helps,
Christian


----------------------------------------------------------------------
Christian Hesse, PhD, MIEEE

F.C. Donders Centre for Cognitive Neuroimaging
P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Tel.: +31 (0)24 36 68293
Fax: +31 (0)24 36 10989

Email: c.hesse at fcdonders.ru.nl
Web: www.fcdonders.ru.nl
----------------------------------------------------------------------




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20070320/e50058fb/attachment.html>


More information about the fieldtrip mailing list