[FieldTrip] Recombining Trials for Source Analysis

Seymour, Robert (Research Student) seymourr at aston.ac.uk
Mon Apr 18 11:13:29 CEST 2016

Dear Fieldtrippers,

I am trying to use an LCMV beamformer to project 5 minutes of resting state data to the source level. During my data cleaning procedure I segment my continuous recording into 1 second "trials" and reject those with high amplitudes (using the ft_rejectvisual summary window). However I would then like to recombine these "trials" (to make 1 long "trial") before I do ft_timelockanalysis. Is there a way to do this whilst keeping the Fieldtrip structure intact . My current code is below:

% Segment into 1s chunks. Input is preprocessed variable called data.

cfg = [];

cfg.length = 1;

cfg.overlap = 0;

data_segmented = ft_redefinetrial(cfg,data);

% Reject deviant trials

cfg = [];

cfg.method = 'summary';

cfg.keepchannel = 'yes';

cfg.channel = 'MEGMAG';

clean1 = ft_rejectvisual(cfg,data_segmented);

% Now load this

cfg.channel = 'MEGGRAD';

clean2 = ft_rejectvisual(cfg,clean1);

data_clean_rs = clean2

clear clean1 clean2

save data_clean_rs data_clean_rs

% Now to recombine trials

data_clean_rs.trial = horzcat(data_clean_rs.trial{1,:}); % (This distorts the fieldtrip structure meaning ft_timelockanalysis doesn't work)

Many thanks,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20160418/32fed83f/attachment-0001.html>

More information about the fieldtrip mailing list