<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div apple-content-edited="true">
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<p class="MsoNormal">Dear all, </p>
<div><br>
</div>
<div>I would like to perform the grand average in a separate script than the preprocessing one, to avoid a crash, because of the number of participants. In the preprocessing script, I performed a timelockanalysis for each participants : <span style="font-family: Courier; font-size: 10px; ">avgFC
= ft_timelockanalysis(cfg, cleandata);</span></div>
<div>and then save this file : </div>
</div>
</div>
<div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">finfname = [subjID{s}
<span style="color: #b245f3">'_RP'</span>];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">mkdir(subjID{s})</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">save([subjPath filesep finfname
<span style="color: #b245f3">'.mat'</span>], <span style="color: #b245f3">'avgFC'</span>);</div>
</div>
<div><br>
</div>
<br class="Apple-interchange-newline">
</div>
So, in my grand average script, I wrote the following :
<div><br>
<div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg = [];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243); ">
<span style="color: #000000">homePath = </span>'/Users/emilie/Desktop/EEG_RP/Grandaverage/'<span style="color: #000000">;</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">eegPath = homePath;</div>
<p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px; ">
<br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
%% Subjects</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(178, 69, 243); ">
<span style="color: #000000">datafiles = {</span>'S83_RP'<span style="color: #000000">,</span>'S84_RP'<span style="color: #000000">,</span>'S85_RP'<span style="color: #000000">,</span>'S87_RP'<span style="color: #000000">,</span>'S88_RP'<span style="color: #000000">,</span>'S89_RP'<span style="color: #000000">,</span>'S90_RP'<span style="color: #000000">,</span>'S91_RP'<span style="color: #000000">,</span>'S92_RP'<span style="color: #000000">,</span>'S93_RP'<span style="color: #000000">,</span>'S94_RP'<span style="color: #000000">,</span>'S97_RP'<span style="color: #000000">,</span>'S98_RP'<span style="color: #000000">,</span>'S99_RP'<span style="color: #000000">,</span>'S100_RP'<span style="color: #000000">,
</span>'S101_RP'<span style="color: #000000">};</span></div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">nFiles = length(datafiles);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">avgs = cell(1,nFiles);</div>
<p style="margin: 0px; font-size: 10px; font-family: Courier; min-height: 12px; ">
<br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.channel =
<span style="color: #b245f3">'all'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">cfg.latency =
<span style="color: #b245f3">'all'</span>;</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); ">
%cfg.parameter = 'avg';</div>
<p style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(37, 153, 45); min-height: 12px; ">
<br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-size: 10px; font-family: Courier; "><span style="color: #0433ff">for</span> iFile = 1:nFiles</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; "> thisfile = datafiles{iFile};</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; "> subjPath = [eegPath thisfile];</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; "> file = dir([subjPath
<span style="color: #b245f3">'*.mat'</span>]);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; "> avgs{iFile} = ft_checkdata(avgs{iFile},
<span style="color: #b245f3">'datatype'</span>, <span style="color: #b245f3">'timelock'</span>,
<span style="color: #b245f3">'feedback'</span>, <span style="color: #b245f3">'no'</span>);</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; "> avgs{iFile} = load(datafiles{iFile});</div>
<div style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(4, 51, 255); ">
end</div>
<p style="margin: 0px; font-size: 10px; font-family: Courier; color: rgb(4, 51, 255); min-height: 12px; ">
<br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-size: 10px; font-family: Courier; ">GA = ft_timelockgrandaverage(cfg, avgs{:}); </div>
</div>
<div><br>
</div>
<div>But I'm not pretty sure to understand the error message : </div>
<div>
<div><font color="#e32400">Error using ft_checkdata (line 366)</font></div>
<div><font color="#e32400">This function requires timelock data as input.</font></div>
<div><font color="#e32400"><br>
</font></div>
<div><font color="#e32400">Error in Averaging (line 33)</font></div>
<div><font color="#e32400"> avgs{iFile} = ft_checkdata(avgs{iFile}, 'datatype', 'timelock', 'feedback', 'no');</font></div>
</div>
<div><br>
</div>
<div>Because If I'm right, the files in 'datafiles' are the time locked data from the preprocessing script.</div>
<div><br>
</div>
<div>Thank you, </div>
<div><br>
</div>
<div>Emilie</div>
<div><br>
</div>
</div>
</body>
</html>