Datastructure inclusion

Shantanu Ghosh sghosh at HSS.IITD.AC.IN
Tue Mar 20 09:37:42 CET 2007


Hi Christian
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?

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}
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{:});


-------------- next part --------------
data = [];
data.fsample = 115.3402;
data.label = {'FP1'; 'FP2'; 'Fz';
%     'F3'; 'F4'; 'F7'; 'F8'; ...
%     'T3'; 'T4'; 'T5'; 'T6';...
%     'P3'; 'P4'; 'Pz'; 'O1'; 'O2'; 'Oz';...\exp1\myDataStructure
%      '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 channels 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]];%...other channels 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]];%...other channels to be added here

time1 = [1,2,3,4,5];
time2 = [.1,.2,.3,.4,.5];
time3 = [1,2,3,4,5];

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



More information about the fieldtrip mailing list