[FieldTrip] how to use ft_stratify?

Vitória Magalhães Piai vitoria.piai at gmail.com
Sun Jun 2 11:17:25 CEST 2013

Hi all,

I'm trying to use ft_stratify for the first time, but (it could be just 
me) I don't find the help info helpful enough :)
What I want to achieve in the end is TFRs of two conditions for which 
the histogram of the reaction time over trials for each condition is 

If I understood ft_stratify correctly (and I doubt that), I could use 
this function to select the trials for each condition such that the 
histograms of the RTs match. Then knowing which trials to keep, I run 
ft_freqanalysis on those specifically.
So question number 1, is that how I should proceed? 'Cause as far as I 
can tell, ft_stratify will not take a whole raw data structure: The help 
says "each input is a Nchan X Nobs matrix". So I have to go for the RTs 

Assuming my approach is correct (ft_stratify on RTs of two conditions, 
then move on with only those trials), I've made a matrix Nchan x 
N_trials for each condition.
% input1 = 265 sensors x 95 RT_trials;
% input2 = 265 sensors x 100 RT_trials;

         cfgst = [];
         cfgst.method      = 'histogram';
         cfgst.equalbinavg = 'no';
         cfgst.numbin      = 4;
         cfgst.numiter     = 2000; % default
         [output,bin] = ft_stratify(cfgst, input1, input2);

I then get an error in line 127:
linearhisto = zeros(ncond, cfg.numbin.^nchan);
??? Error using ==> zeros
Maximum variable size allowed by the program is exceeded.

Apparently, zeros(2, 4^265) is something matlab doesn't want to calculate!
Am I doing something wrong here? Has anyone worked with this function 
before (with such a number of sensors)?

Any help is greatly appreciated!
Cheers, Vitória

More information about the fieldtrip mailing list