I wish to convert data from fieldtrip to eeglab using fieldtrip2eeglab function. My Data.trial is a cell array, and apply the follwing code, it gives me an error on line 17, "not enough arguments". Can anyone please help, to figure me out the error?

16 views (last 30 days)
endfunction [EEG] = fieldtrip2eeglab(data)
load chanlocs.mat
EEG.chanlocs = chanlocs;
%EEG.chanlocs = [];
for i=1:size(data.trial,2)
EEG.data(:,:,i) = single(data.trial{i}); % error here at line 17
EEG.setname = data.cfg.dataset;
EEG.filename = '';
EEG.filepath = '';
EEG.subject = '';
EEG.group = '';
EEG.condition = '';
EEG.session = [];
EEG.comments = 'preprocessed with fieldtrip';
EEG.nbchan = size(data.trial{1},1);
EEG.trials = size(data.trial,2);
EEG.pnts = size(data.trial{1},2);
EEG.srate = data.fsample;
EEG.xmin = data.time{1}(1);
EEG.xmax = data.time{1}(end);
EEG.times = data.time{1};
EEG.ref = []; %'common';
EEG.event = [];
EEG.epoch = [];
EEG.icawinv = [];
EEG.icasphere = [];
EEG.icaweights = [];
EEG.icaact = [];
EEG.saved = 'no';
eeglab redraw
pop_eegplot( EEG, 1, 1, 1);
%%%%%%%%%%%%%%%% error msg %%%%%%%%%%%%%%%%%%%%%%%%%
eglab: options file is C:\Users\Differentielle 222\eeg_options.m
EEGLAB: adding "Biosig" to the path; subfolders (if any) might be missing from the path
EEGLAB: adding "bva-io" v1.5.13 (see >> help eegplugin_bva_io)
EEGLAB: adding "dipfit" v2.3 (see >> help eegplugin_dipfit)
EEGLAB: adding "firfilt" v1.6.2 (see >> help eegplugin_firfilt)
Error using fieldtrip2eeglab (line 17)
Not enough input arguments.
Bubblesjinx on 27 Jun 2018
Edited: Bubblesjinx on 27 Jun 2018
Hi RIk, I have attached three matlab files. cued.m extract the EEG signal between 'S100' to 'S102' (S100 and S102 are the triggers supplied onset of stimuli to the time when participant started typing the answer). i am interested in the signal between these triggers. 1prepro_trudy.m preprocess the data and concatenate the trials. fieldtrip2eeglab is where I wish to convert the data format from fieldtrip to EEGLAB.

Sign in to comment.

Answers (0)


Find more on EEG/MEG/ECoG in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!