<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0);">
<div style="font-size: 14px; font-family: Georgia, sans-serif; color: rgb(0, 0, 0);">
<span style="font-family: Times;">Dear fieldtripers, </span></div>
<span id="OLK_SRC_BODY_SECTION" style="font-size: 14px; color: rgb(0, 0, 0);">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px;">
<span id="OLK_SRC_BODY_SECTION">
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px;">
<p style="font-family: Georgia, sans-serif; margin: 0px; line-height: normal;"><font face="Times"><br>
</font></p>
<p style="font-family: Georgia, sans-serif; margin: 0px; line-height: normal;"><font face="Times">This is a kind reminder of a follow-up question to a previous question with the same mail-topic. </font></p>
<p style="font-family: Georgia, sans-serif; margin: 0px; line-height: normal;"><br>
</p>
<p style="font-family: Georgia, sans-serif; margin: 0px; line-height: normal;"><font face="Times">I have included my code below to show what I am doing (in case I have made errors) and print screens (follow dropbox-link below) of the variables I get after the
 ft_componentanalysis that I get. </font></p>
<p style="font-family: Georgia, sans-serif; margin: 0px; line-height: normal;"><font face="Times"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Times">Sadly, I cannot see any variable named comp.trial (see ft_componentanalysis-result1.tiff, or ft_componentanalysis-result2.tiff). Also, when running the PCA in matlab, I get a coefficient array
 that has as many entries as there are time-points in my trials (see matlab_pca_results.tiff) . Why am I not getting that in ft? Is it possible to get that using ft?
</font></p>
</div>
</div>
</span></div>
</span>
<div style="font-size: 14px; font-family: Georgia, sans-serif; color: rgb(0, 0, 0);">
<br>
</div>
<span id="OLK_SRC_BODY_SECTION" style="font-size: 14px; font-family: Georgia, sans-serif; color: rgb(0, 0, 0);">
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Georgia, sans-serif;">
<span id="OLK_SRC_BODY_SECTION">
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Georgia, sans-serif;">
<p style="margin: 0px; line-height: normal;"><span style="font-family: Times;">Pictures are found using this link:
</span></p>
</div>
</div>
</span></div>
</div>
</span>
<div><a href="https://www.dropbox.com/sh/k6ax6bvjb5yi13l/AADvwBzGduIXlCLaPBS4_ELya?dl=0"><font face="Times" style="font-size: 10px;"><b>https://www.dropbox.com/sh/k6ax6bvjb5yi13l/AADvwBzGduIXlCLaPBS4_ELya?dl=0</b></font></a></div>
<div style="font-size: 14px; font-family: Georgia, sans-serif;"><br>
</div>
<span id="OLK_SRC_BODY_SECTION" style="font-size: 14px; font-family: Georgia, sans-serif; color: rgb(0, 0, 0);">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0);">
<span id="OLK_SRC_BODY_SECTION">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0);">
<p style="font-size: 14px; font-family: Georgia, sans-serif; margin: 0px; line-height: normal;">
<font face="Times">Very Best,</font></p>
<p style="font-size: 14px; font-family: Georgia, sans-serif; margin: 0px; line-height: normal;">
<font face="Times">Isac</font></p>
<p style="font-size: 14px; font-family: Georgia, sans-serif; margin: 0px; line-height: normal;">
<br>
</p>
<p style="font-size: 14px; font-family: Georgia, sans-serif; margin: 0px; line-height: normal;">
<br>
</p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">————————————————— The code —————————————————</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">clear all; close all;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">%% Load </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">load('averages_for_ft.mat')</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">%% define layout</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfg = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfg.elec=PreOdd_ft{1, 1}.elec; </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfg.rotate=90; %rotation around the z-axis in degrees (default = [], which means automatic)</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">layout = ft_prepare_layout(cfg)</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">%% Make the computations</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">% Dummy varibles </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">Cond1 = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">Cond2 = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">theDiff = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">theDiff_ft = {};</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">%% Start loop</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">for i=1:size(Cond1_ft,2)</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    %Get the basic condtitions</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    curr_Cond2 = Cond2_ft{i}.avg;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    curr_Cond1 = Cond1_ft{i}.avg;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    %Get the basic condtitions</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    cfg = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    curr_Cond2_ft = ft_timelockanalysis(cfg, Cond2_ft{i});</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    curr_Cond1_ft = ft_timelockanalysis(cfg, Cond1_ft{i});</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    % Then take the difference of the averages using ft_math</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    cfg  = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    cfg.operation = 'subtract';</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    cfg.parameter = 'avg';</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    curr_difference = ft_math(cfg,curr_Cond1_ft,curr_Cond2_ft);</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    curr_difference_avg = curr_difference.avg;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    % Creating a struct with the subjectwise differences between conditions</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    theDiff_ft{i} = curr_difference</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    % constructing concatenated averaged sets for the PCA. </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    Cond2 = [Cond2 curr_Cond2];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    Cond1 = [Cond1 curr_Cond1];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    theDiff = [theDiff curr_difference_avg];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">end</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">%% Create dummy subjects in order to run the PCA over subjects</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">dummy_Cond2 = Cond2_ft{1};</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">dummy_Cond2.avg = Cond2; </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">dummy_Cond2.time = 1:1:size(Cond2,2);</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">dummy_Cond1 = Cond1_ft{1};</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">dummy_Cond1.avg = Cond1; </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">dummy_Cond1.time = 1:1:size(Cond1,2);</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">dummy_theDiff = Cond1_ft{1};</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">dummy_theDiff.avg = theDiff; </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">dummy_theDiff.time = 1:1:size(theDiff,2);</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">%% Run the PCA</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfg = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfg.method  = 'pca';</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfg.layout = layout;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">Cond1_comp = ft_componentanalysis(cfg, dummy_Cond1);</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">Cond2_comp = ft_componentanalysis(cfg, dummy_Cond2);</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">theDiff_comp = ft_componentanalysis(cfg, dummy_theDiff);</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">%% Revert back to subject level</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"><br>
</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfgCond2 = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfgCond2.unmixing = Cond2_comp.unmixing;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfgCond2.topolabel = Cond2_comp.topolabel;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfgCond1 = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfgCond1.unmixing = Cond1_comp.unmixing;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfgCond1.topolabel = Cond1_comp.topolabel;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfgtheDiff = [];</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfgtheDiff.unmixing = theDiff_comp.unmixing;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">cfgtheDiff.topolabel = theDiff_comp.topolabel;</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;"> </font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">for i=1:size(Cond1_ft,2)</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    Cond1_rs{i} = ft_componentanalysis(cfgCond1, Cond1_ft{i});</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    Cond2_rs{i} = ft_componentanalysis(cfgCond2, Cond2_ft{i});</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">    theDiff_rs{i}= ft_componentanalysis(cfgtheDiff, theDiff_ft{i} );</font></p>
<p style="margin: 0px; line-height: normal;"><font face="Arial" style="font-size: 10px;">end</font></p>
</div>
</span></div>
</span>
</body>
</html>