<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Philip,
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">and likewise for the new channel dimension:</div>
<div class="">for k = 1:size(data.trial{1},1)</div>
<div class="">data.label{k} = sprintf(‘chan%05d’,k);</div>
<div class="">end</div>
<div class=""><br class="">
</div>
<div class="">Then Bob’s your uncle, that is, probably ft_componentanalysis will swallow the data.</div>
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 25 Aug 2020, at 18:56, philip Joadavi <<a href="mailto:p.joadavi@gmail.com" class="">p.joadavi@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Dear all,
<div class=""><br class="">
</div>
<div class="">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 class="">spatial PCA</b>)). </div>
<div class=""><br class="">
</div>
<div class="">Is that possible to work around the function 'ft_componentanalysis'  to perform the
<b class=""><u class="">temporal PCA</u></b> using field trip?</div>
<div class=""><br class="">
</div>
<div class="">Thanks!</div>
<div class="">Philip Joadavi</div>
<div class=""><br class="">
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://doi.org/10.1371/journal.pcbi.1002202<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>