<div dir="ltr"><div>
Dear Jaewon, <br></div><div><br></div><div>I just want to ask in order to be sure. For example
<span style="font-size:13.3333px">HH_timelock variable contains all the participants like the attached format. Each struct contains FieldTrip output fields for each participants.Then you can use
<span style="font-size:13.3333px">HH_timelock{:}. If your dataset is not in this format, maybe you can try this way once more.</span>
</span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 24, 2022 at 1:27 PM "오재원" via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl">fieldtrip@science.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"><p style="border:0px none;padding:0px;margin:0px;font-family:"\00ad74\00b9bc";font-size:10pt"></p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">Dear Julian,</p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px"><br></p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">Thank you for the response. Yes, I have tried adding {:} after each structure but Matlab said {:} cannot be attached to 'structure'.</p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">So I tried altering the structures to cell arrays and then adding {:} to the cell arrays as the following codes:</p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px"><br></p><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">%% permutation test statistical analysis</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">HH_timelock = struct2cell(HH_timelock);</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">HN_timelock = struct2cell(HN_timelock);</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">LH_timelock = struct2cell(LH_timelock);</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">LN_timelock = struct2cell(LN_timelock);</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px"><br></span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">[stat] = ft_timelockstatistics(cfg, HH_timelock{:}, HN_timelock{:}, LH_timelock{:}, LN_timelock{:});</span></p></blockquote></blockquote><p style="border:0px none;padding:0px;margin:0px"><br></p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">But it did not work.</p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px"><br></p><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">Error: matlab.internal.doc.updateConnectorDocroot (Line 3)</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px"> options = weboptions('RequestMethod','post', ...</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px"> </span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">Warning: Your path is set up incorrectly. You probably used addpath(genpath('path_to_fieldtrip')), this can lead to</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">unexpected behavior. See</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px"><a href="http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path" target="_blank">http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path</a> </span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px"></span></p><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">Error: ft_checkdata (538번 라인)</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">This function requires timelock data as input, see ft_datatype_timelock.</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px"><br></span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">Error: ft_timelockstatistics (87번 라인)</span></p></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><p style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px"> varargin{i} = ft_checkdata(varargin{i}, 'datatype', 'timelock', 'feedback', 'no');</span></p></blockquote></blockquote><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px"><br></p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">I am wondering what I can do more at this point.</p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px"><br></p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">Best,</p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px"><br></p><p style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">Jaewon</p><div style="font-family:돋움,arial;font-size:12px;margin-top:30px;margin-left:0.8em;color:rgb(0,102,204);font-weight:bold">--------- 원본 메일 ---------</div><blockquote style="font-family:굴림;font-size:12px;border-left-style:solid;border-left-width:2px;margin:0pt 0pt 0pt 0.8em;padding-left:1em"><div style="font-family:arial,돋움;line-height:1.5"><b>보낸사람</b> : Julian Keil via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br><b>받는사람</b> : FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br><b>참조</b> : Julian Keil <<a href="mailto:julian.keil@gmail.com" target="_blank">julian.keil@gmail.com</a>><br><b>받은날짜</b> : 2022-06-24 (금) 17:27:30<br><b>제목</b> : Re: [FieldTrip] ft_timelockstatistics design matrix<br><div style="margin-top:5px">Dear Jaewon,<div><br></div><div>are "<font size="2">HH_timelock, HN_timelock, LH_timelock, LN_timelock“ your data structures containing the single participants?</font></div><div><font size="2">Have you tried adding {:} after the structures (e.g., </font><span style="font-size:13.3333px">HH_timelock</span><span style="font-size:small">{:}</span><span style="font-size:13.3333px">, HN_timelock</span><span style="font-size:small">{:}</span><span style="font-size:13.3333px">, LH_timelock</span><span style="font-size:small">{:}</span><span style="font-size:13.3333px">, LN_timelock</span><span style="font-size:small">{:})?</span></div><div><span style="font-size:small">Are the same numbers of participants in all structures?</span></div><div><span style="font-size:small"><br></span></div><div><span style="font-size:small">Good luck,</span></div><div><span style="font-size:small"><br></span></div><div><span style="font-size:small">Julian</span></div><div><span style="font-size:small"><br></span></div><div><div><br><blockquote type="cite"><div>Am 24.06.2022 um 09:33 schrieb 오재원 via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>>:</div><br><div><p style="border:0px none;padding:0px;margin:0px;font-family:"\00ad74\00b9bc";font-size:10pt"></p><div style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px"><br></div><div style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">Hello,</div><div style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px"><br></div><div style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">I was trying cluster-based permutation using ft_timlockstatistics, but I got an error regarding design matrix.</div><div style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px">The code I used is as following:</div><div style="font-family:굴림;font-size:10pt;border:0px none;padding:0px;margin:0px"><br></div><p style="font-family:굴림;font-size:10pt;line-height:1.5;margin-bottom:0px;margin-top:0px"></p><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">%% Permutation test</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">[ftver, ftpath] = ft_version;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cd(fullfile(ftpath, 'template', 'electrode'));</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">elec = ft_read_sens('standard_1020.elc');</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">% there are some of which the orientation cannot be determined (T3, T4, T5, T6)</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">ft_plot_sens(elec, 'label', 'yes', 'elecshape', 'disc', 'elecsize', 10, 'facecolor', [0.8 0.8 1.0])</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">% give it a stronger 3D appearance</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">camlight headlight</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg = [];</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.elec = elec;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.channel = {'Fp1', 'Fpz', 'Fp2', 'F7', 'F3', 'Fz', 'F4', 'F8', 'T7', 'C3', 'Cz', 'C4', 'T8', 'P7', 'P3', 'Pz', 'P4', 'P8', 'O1', 'Oz', 'O2'};</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.method = 'distance';</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.feedback = 'yes';</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.neighbourdist = 100;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">neighbours = ft_prepare_neighbours(cfg);</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">design = [1:nSubjs 1:nSubjs 1:nSubjs 1:nSubjs; ones(1,nSubjs) ones(1,nSubjs)*2 ones(1,nSubjs)*3 ones(1,nSubjs)*4];</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg = [];</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.channel = {'EEG'};</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.latency = [0 0.6];</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.method = 'ft_statistics_montecarlo';</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.clusterthreshold = 'nonparametric_common';</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.neighbours = neighbours;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.statistic = 'ft_statfun_depsamplesFmultivariate';</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.correctm = 'cluster';</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.clusteralpha = 0.05;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.clusterstatistic = 'maxsum';</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.minnbchan = 2;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.tail = 0;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.clustertail = 0;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.alpha = 0.025;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.numrandomization = 500;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.design = design;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.uvar = 1;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">cfg.ivar = 2;</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><br></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">%% permutation test statistical analysis</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="border:0px none;padding:0px;margin:0px"><span style="font-size:13.3333px">[stat] = ft_timelockstatistics(cfg, HH_timelock, HN_timelock, LH_timelock, LN_timelock);</span></div><div style="border:0px none;padding:0px;margin:0px"><br></div></blockquote></blockquote>And the error message :<div><br></div><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="line-height:1.5;margin-bottom:0px;margin-top:0px"><span style="font-size:13.3333px"> ft_timelockstatistics (172번 라인)</span></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:medium none;padding:0px"><div style="line-height:1.5;margin-bottom:0px;margin-top:0px"><span style="font-size:13.3333px">the length of the design matrix (2) does not match the number of observations in the data (4)</span></div><div style="line-height:1.5;margin-bottom:0px;margin-top:0px"><br></div></blockquote></blockquote><span style="font-size:13.3333px">I could not find any problem in my code and I followed the way the fieldtrip tutorial instructed. I have four conditions and I put four repetitions of 1:nSubjs in the unit variable (cfg.uvar) and nSubjs number of ones, twos, threes, and fours each in the independent variable (cfg.ivar). It would be so grateful if you can tell me how to solve this problem. Best, Jaewon</span><div><br></div>
<img src="https://mail.snu.ac.kr/checkread/MTU4NDQ3NTI0Mg==/ZmllbGR0cmlwQHNjaWVuY2UucnUubmw=/" width="1px" height="1px">_______________________________________________<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></div></blockquote><p></p>
<img src="https://mail.snu.ac.kr:443/checkread/MTU4NDUwNTE4Nw==/ZmllbGR0cmlwQHNjaWVuY2UucnUubmw=/" width="1px" height="1px">_______________________________________________<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>