generating data structure for all trials
c.hesse at FCDONDERS.RU.NL
Fri Feb 9 09:33:17 CET 2007
first of all (in reference to your other email): have you managed to
get hold of the componentanalysis function yet?
On 8 Feb 2007, at 18:59, Sameer Walawalkar wrote:
> My basic question is:
> Can definetrial be used in such a way as to create the data
> structure without breaking the data up into trials? or Is there
> some other way to generate the data structure with all its fields
> without breaking the data up into trials?
In principle you could define a single trial that contains all of
your data, but you don't really want to do that.
> What follows is a bit more information.
> The first twenty independent components of my data acquired by using
> EEGlab or fastICA contain blinks, heart beats and other extraneous
> signals which I can subtract. I can infact do all the preprocessing
> on my data that Fieldtrip can do. The problem is in order to now
> use Fieldtrip for further analysis (I want to eventually do DICS),
> I have to generate the data structure with all its fields as
> fieldtrip likes it, and that seems tedious.
> Hence I want to stick with Fieldtrip all the way.
> However, while using Fieldtrip, the first point where a MATLAB
> containing data is created is during trial definition at
> data = preprocessing(cfg); (from online tutorial)
> Trial rejections, and independent component analysis is done after
> Instead I would prefer to use independent component analysis
> first to
> remove blinks etc, then do channels and trial rejections, and then
> do the
> trial definitions based on event types etc.
> Central to this is having the structure data with all its fields
> before using componentanalysis.m. Can definetrial be used in such
> a way
> as to create the data structure without breaking the data up into
> Is there some other way to generate this structure without breaking
> data up into trials?
some of the low-level I/O functions can read the data into a matrix
for you, but then the housekeeping becomes awkward if you later want
to extract the trials (it is doable, but I really do not recommend it).
The function componentanalysis actually concatenates all trials
before estimating the ICA model, so the fact that pre-processed data
is split into trials is not an obstacle to doing what you want to do.
Sure, you might miss out a few bits of data between trials, but as
such that does not matter in ICA (e.g., infomax, fastica) anyway,
since it treats the data as a random variables and not time-series.
I would just try doing the ICA on the trial-based data, remove the
artifacts and then see if it sufficiently improves your analysis. You
could always define your trials in such a way that they correspond to
the "raw" signal when you concatenate them.
One more thing: if you need (or want) to remove channels from your
data then either do it as part of the ICA (if the bad channels don't
make the ICA "fall over") or remove them first and then do ICA. Doing
ICA first to remove only ocular artifacts, then recombining the
signals and rejecting channels strikes me as a potentially
Hope this helps.
p.s. another (and somewhat unorthodox from a FT perspective) solution
might be to do ICA as you have been outside of Fieldtrip and simply
apply the de-mixing (W) matrix to your trialbased data in Fieldtrip
(need to keep track of the channel labels though!). That might be the
solution closest to your wishes. You would have to rescale as follows
though (assuming square W): A = inv(W), set columns of A to unit
norm, W = inv(A).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fieldtrip