<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; ">Hi Sameer,<DIV><BR class="khtml-block-placeholder"></DIV><DIV>first of all (in reference to your other email): have you managed to get hold of the componentanalysis function yet?</DIV><DIV><BR class="khtml-block-placeholder"><DIV><BR><DIV><DIV>On 8 Feb 2007, at 18:59, Sameer Walawalkar wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hello,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">My basic question is:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">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?</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>In principle you could define a single trial that contains all of your data, but you don't really want to do that.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">What follows is a bit more information.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The first twenty independent components of my data acquired by using</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">EEGlab or fastICA<SPAN class="Apple-converted-space">  </SPAN>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.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hence I want to stick with Fieldtrip all the way.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">However, while using Fieldtrip, the first point where a MATLAB variable</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">containing data is created is during trial definition at</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">data = preprocessing(cfg); (from online tutorial)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Trial rejections, and independent component analysis is done after this.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Instead I would prefer to<SPAN class="Apple-converted-space">  </SPAN>use independent<SPAN class="Apple-converted-space">  </SPAN>component analysis first<SPAN class="Apple-converted-space">  </SPAN>to</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">remove blinks etc, then do channels and trial rejections, and then do the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">trial definitions based on event types etc.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Central to this is having the structure data with all its<SPAN class="Apple-converted-space">  </SPAN>fields defined</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">before using componentanalysis.m.<SPAN class="Apple-converted-space">  </SPAN>Can definetrial be used in such a way</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">as to create the data structure without breaking the data up into trials?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Is there some other way to generate this structure without breaking the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">data up into trials?</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>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).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>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.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>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.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>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 problematic approach.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Hope this helps.</DIV><DIV>Christian</DIV></DIV><DIV><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "></SPAN><BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN></SPAN></SPAN> </DIV>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).</DIV><DIV><BR></DIV></DIV></BODY></HTML>