[FieldTrip] shifting data time

anne Hauswald anne.hauswald at me.com
Fri Oct 28 10:36:31 CEST 2016


Hi Mona, 

if you do
cfg=[];
all=ft_appenddata(cfg, data1, data2, data3, data4); 

you get among the other fields
all=
time: 	{1x4 cell} %assuming each dataset equals one trial, which is what you want to replace.

you could try to create a matrix, based on your sampling rate with all the continuous time points, here just for illustration: 
all_timepoints=[0:0.025:9.975]  %adapt to your sampling rate and length of data, be very sure the end of one file is the beginning of the next one. (This is giving you all points from 0 to 9.975 with steps of 0.025)
trl_timepoints=mat2cell(all_timepoints, 1, [100 100 100 100]) %here I create 4 cell arrays, corresponding e.g. to 4 trials

will result in
trl_timepoints = 
    [1x100 double]    [1x100 double]    [1x100 double]    [1x100 double] 

with continuous time information (trial 1 starts at 0, trial 2 at 2.5, trials 3 at 5, and trial 4 at 7.5) of the same length.
this you can then use to replace the original time information:

all_data.time_old=all_data.time %if you want to keep the original time information
all_data.time=trl_timepoints

In general: are you really sure that you need the continuous time information? There are many processing and analyses steps that can be done on the appended time information…

There might be more elegant ways to do this.

Hope there is no typo and that it helps
Best Anne


> Am 28.10.2016 um 00:48 schrieb Wong-Barnum, Mona <mona at sdsc.edu>:
> 
> 
> Hi:
> 
> 	I need a way to “stitch” together a single subject’s data recorded over many hours which were saved in 14 separate files.  When stitched together, file 1 end time is the start time of file 2, file 2 end time is the start of file 3, and so on.  Unfortunately the recorded files all start at time t = 0 so ft_appenddata() put them into 14 separate trials.  I need to shift the time for each file so they will be jointed into a single trial.  I didn’t find any ft_ function to do this.  Any suggestions?
> 
> thanks,
> Mona
> 
> ************************************************
>    Mona Wong
>    Web & iPad Application Developer
>    San Diego Supercomputer Center
> 
>    You are the light you wish to see.
> ************************************************
> 
> 
> 
> 
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> https://mailman.science.ru.nl/mailman/listinfo/fieldtrip

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


More information about the fieldtrip mailing list