


TRIGG cuts continous sequence into segments.
Missing values (in case s is to short) are substituted by NaN's.
[X,sz] = trigg(s, TRIG, PRE, PST [, GAP])
INPUT:
S is the continous data sequence (1 channel per column)
TRIG defines the trigger points
PRE offset of the start of each segment (relative to trigger)
PST offset of the end of each segment (relative to trigger)
GAP number of NaN's to separate trials (default=0)
TRIG, pre, post and gap are counted in samples
OUTPUT:
X is a matrix of size [sz(1), sz(2)*sz(3)]
sz [size(s,2), post-pre+1+gap, length(TRIG)]
sz(1) is the number of channels NS
sz(2) is the number of samples per trial
sz(3) is the number of trials i.e. length(TRIG)
X3D = reshape(X,sz) returns a 3-dimensional matrix
X2D = reshape(X(K,:),sz(2:3)) returns channel K in a 2-dimensional matrix
see also: GETTRIGGER