<div dir="ltr">Dear Jan-Mathijs,<div><br></div><div>Thank you so much for your quick reply. I tried it and it's working. I used 'SVD' instead of 'PCA'. </div><div>Just to be sure I have a follow-up question, I want to use <b>ft_rejectcomponent</b> after that (I mean after ft_componentanalysis), can I just use it as it is or I have to do some other tricks also before using ft_rejectcomponent? </div><div><br></div><div>Thanks a lot,</div><div>Philip</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 26, 2020 at 8:42 AM Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl">jan.schoffelen@donders.ru.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">



<div style="overflow-wrap: break-word;">
Hi Philip,
<div><br>
</div>
<div>You could try and hack your way around, by transposing the time courses. Assuming you have just a single epoch in your data structure (or all epochs have the exact same length)  (otherwise it will not work), you can do: for k = 1:numel(data.trial)
 data.trial{k} = data.trial{k}’ ; end</div>
<div><br>
</div>
<div>Then you need to fool Fieldtrip into ’thinking’ that the -what used to be the channel dimension- is the time dimension: data.time{:} = (1:size(data.trial{1},2))./data.fsample;</div>
<div><br>
</div>
<div>and likewise for the new channel dimension:</div>
<div>for k = 1:size(data.trial{1},1)</div>
<div>data.label{k} = sprintf(‘chan%05d’,k);</div>
<div>end</div>
<div><br>
</div>
<div>Then Bob’s your uncle, that is, probably ft_componentanalysis will swallow the data.</div>
<div><br>
</div>
<div>Note however, that the pca algorithm implemented in FT is not very clever, so it will probably not deal well with ill-conditioned covariance matrices, which you’re likely to end up with, since the number of time points is typically much larger
 than the number of channels.</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Jan-Mathijs</div>
<div><br>
</div>
<div>
<div><br>
<blockquote type="cite">
<div>On 25 Aug 2020, at 18:56, philip Joadavi <<a href="mailto:p.joadavi@gmail.com" target="_blank">p.joadavi@gmail.com</a>> wrote:</div>
<br>
<div>
<div dir="ltr">Dear all,
<div><br>
</div>
<div>I would like to work with PCA on my EEG data using Fieldtrip. As far as I know, the implementation of PCA in Fieldtrip is only on spatial (i.e the variables are the EEG channels (
<b>spatial PCA</b>)). </div>
<div><br>
</div>
<div>Is that possible to work around the function 'ft_componentanalysis'  to perform the
<b><u>temporal PCA</u></b> using field trip?</div>
<div><br>
</div>
<div>Thanks!</div>
<div>Philip Joadavi</div>
<div><br>
</div>
</div>
_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</div>
</blockquote>
</div>
<br>
</div>
</div>

_______________________________________________<br>
fieldtrip mailing list<br>
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
<a href="https://doi.org/10.1371/journal.pcbi.1002202" rel="noreferrer" target="_blank">https://doi.org/10.1371/journal.pcbi.1002202</a><br>
</blockquote></div>