[FieldTrip] Possible BUG in ft_redefinetrial using the cfg.trl option
Eelke Spaak
eelke.spaak at donders.ru.nl
Wed Mar 25 13:27:21 CET 2015
Hi Andrea,
I cannot reproduce the error you mention:
%% create some data
data = [];
data.label = {'a'};
for k = 1:3
data.sampleinfo(k,:) = [1+(k-1)*1000 k*1000];
data.time{k} = 1:1000;
data.trial{k} = ones(1,1000) .* k;
end
%% redefine
cfg = [];
cfg.trl = [500 600 0;
800 1200 0;
2500 2700 0];
data_out = ft_redefinetrial(cfg, data);
%% check
assert(all(data_out.trial{1}(:) == 1));
assert(sum(data_out.trial{2}(:) == 1) == 201);
assert(sum(data_out.trial{2}(:) == 2) == 200);
assert(all(data_out.trial{3}(:) == 3));
Could it be something else?
Best,
Eelke
On 20 March 2015 at 15:14, andrea brovelli <andrea.brovelli at univ-amu.fr> wrote:
> Dear all,
>
> The bugzilla server seems to be down for maintenance. So I post it here.
>
> I noticed a possible bug in ft_redefinetrial: if I realign my data on a different event using the cfg.trl option, the output data is corretly aligned, BUT the output data structure contains ONLY the first trial of the input data structure, repeated for the exact number of trials.
>
> % In other words, if you do this...
> cfg = [];
> cfg.trl = trl; % N x 3 matrix = [ sample_start sample_end sample_offset ]
> data_out = ft_redefinetrial(cfg, data_in);
>
> % And then plot the first 3 trials for the first channel....
> plot(data_out.time{1},data_out.trial{1}(1,:),'b')
> hold on
> plot(data_out.time{2},data_out.trial{2}(1,:),'r')
> plot(data_out.time{3},data_out.trial{3}(1,:),'k')
>
> ... you will notice that you are plotting the first trial in the original data_in but shifted in time.
>
> Could you also check please ?
>
> I used the latest version of Fieldtrip fieldtrip-20150318
>
> Thanks
>
> Andrea
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip
More information about the fieldtrip
mailing list