<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="">
Yes, you need to add a singleton dimension, to ensure that the result will be rpt_chan_freq_time, even if there’s only a single channel.
<div class=""><br class="">
</div>
<div class="">Good luck,</div>
<div class="">JM<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 6 Feb 2024, at 13:29, Knut-André Skaug via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Hi Jan-Mathijs<o:p class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Thank you for the suggestion.<span class="Apple-converted-space"> </span><o:p class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Just so I can understand better: do you suggest to add a singleton to the datamatrix before permuting the dimensions?<o:p class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I would like to use the cluster-correction method in fieldtrip at single-subject level to test between condition differences in time-frequency.<o:p class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Would it be correct to permute: ‘rpt_freq_time’ ?<span class="Apple-converted-space"> </span><o:p class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Kind regards<o:p class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Knut<span class="Apple-converted-space"> </span><o:p class=""></o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div class="">
<div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(225, 225, 225); padding: 3pt 0cm 0cm;" class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<b class="">From:</b><span class="Apple-converted-space"> </span>fieldtrip <<a href="mailto:fieldtrip-bounces@science.ru.nl" class="">fieldtrip-bounces@science.ru.nl</a>><span class="Apple-converted-space"> </span><b class="">On Behalf Of<span class="Apple-converted-space"> </span></b>Schoffelen,
 J.M. (Jan Mathijs) via fieldtrip<br class="">
<b class="">Sent:</b><span class="Apple-converted-space"> </span>Wednesday, December 6, 2023 9:16 AM<br class="">
<b class="">To:</b><span class="Apple-converted-space"> </span>FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>><br class="">
<b class="">Cc:</b><span class="Apple-converted-space"> </span>Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:janmathijs.schoffelen@donders.ru.nl" class="">janmathijs.schoffelen@donders.ru.nl</a>><br class="">
<b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [FieldTrip] Question about dataformat when using cluster based permutation testing on time-frequency data<o:p class=""></o:p></div>
</div>
</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Hi Knut-André, <span class="Apple-converted-space"> </span><o:p class=""></o:p></div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I think that this can be solved if you do your best to be a bit more work into shaping your data structure into something that Fieldtrip likes:<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
G.dimord = ‘rpt_chan_freq_time’;<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
G.powspctrm = permute(shiftdim(tf_datamatrix,-1),[4 1 2 3]);<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
G.freq = frex;<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
G.time = <the time-axis, consisting of a vector with the number of points along the fourth dimension of the powspctrm matrix>;<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
G.label = {‘harry_hole’};<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Best wishes,<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Jan-Mathijs<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<br class="">
<br class="">
<o:p class=""></o:p></div>
<blockquote style="margin-top: 5pt; margin-bottom: 5pt;" class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
On 4 Dec 2023, at 10:21, Knut-André Skaug via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" style="color: blue; text-decoration: underline;" class="">fieldtrip@science.ru.nl</a>> wrote:<o:p class=""></o:p></div>
</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
<div class="">
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Hello,<span class="apple-converted-space"> </span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Thank you for providing this toolbox.<span class="apple-converted-space"> </span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
My question pertains to the data format in order to run permutation testing on time-frequency data in source space.<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Because I have already extracted the time-frequency data matrix I wish to continue with the function ft_freqanalysis to run cluster-corrected permutation testing.<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
The time-frequency data matrix have dimensions: Frequency x Time x Trials.<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Thus, there are no channels in this matrix.<span class="apple-converted-space"> </span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
I’ve tried to set the data structure to be:<span class="apple-converted-space"> </span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
G.dimord = ‘freq_time_rpt’;<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
G.powspctrm = tf_datamatrix;<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
G.freq = frex;<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
But this returns an error message when following the tutorial on cluster-based permutation testing – between trials – both on event-related fields and time-frequency data.<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
How can I carry out cluster-based permutation testing on my two time-frequency matrices, Condition A and Condition B?<o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Kind regards<span class="apple-converted-space"> </span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
Knut<span class="apple-converted-space"> </span><o:p class=""></o:p></div>
</div>
<div class="">
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
 <o:p class=""></o:p></div>
</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<span style="font-size: 10.5pt; font-family: Helvetica, sans-serif;" class="">_______________________________________________<br class="">
fieldtrip mailing list<br class="">
</span><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C2ec1369abe884e94f77b08dc272614bc%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638428291706280140%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=KBnbW5%2BUEvjtG%2FiHouM9JXg3s0Yw7741WlrycIFCQvM%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" shash="U+/gv3kRsTRMMYUOmntE5qBjpS5wGG9S+3yTyS7+RvsBnnpzip8jxmz2dRWXwxXOWh0yW7fH7dEVqgvHzR7jT1VH+7UMkVJ1ML8NKV/QnAEx09QUdqVHjTD6Tx1y2lEOSI9LNXLurxVOoZS9SjDIkztQjcttLfYxKTZAhsaTJ10=" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" shash="wCUSWHylo1CK7HUsXwgsc9xUZNsPN2/ZOfwEbj75PSJoxlqVusbN2eoRnwdj8FwBUZK6FYgtg7akEulsw1u0I5YuNrp+7oGRAVv7PqPwPz4QcLu+bbRDuV5Jeg12uek1Zlccz+02UjH1EpkPf/dJ17PqK9FxRVD0jH6HC4CW6o8=" style="color: blue; text-decoration: underline;" class=""><span style="font-size: 10.5pt; font-family: Helvetica, sans-serif;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</span></a><span style="font-size: 10.5pt; font-family: Helvetica, sans-serif;" class=""><br class="">
</span><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C2ec1369abe884e94f77b08dc272614bc%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638428291706280140%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=exjaETWK2S7zhJ1G46hBhhhEO5GlwPtGlH53%2FE3%2FwFQ%3D&reserved=0" originalsrc="https://doi.org/10.1371/journal.pcbi.1002202" shash="mx3V5cFP5mqHyRnRJ0vc+WZLD2IwN9CHwnJpsrqVbnyc/5qkrm3xLOqiUxjsJQ6tYYPSG3ItesSR0rSLHe0sO/H6ZY3Su0Xae7oKzc+jfh3YGXzGV8XKq/X56n1uVbrPYtCMBTX33cEBxJrfKGmRiCDwiWIznl803ZqPDa0M9Kg=" originalsrc="https://doi.org/10.1371/journal.pcbi.1002202" shash="UDoqLROH/XMk4Y6C3PNLA0Y4zqwrinxiV/88VCb34ReyyjcvfGuL8FQu03C0SEPkKPZrrhgXvUv910SiKcFu++r0QQ853hN4laxuwsNsJT7nPkhSjy4EAJ2PLC80c13HHEoNrczdm8W/arUtCTBME7GtwIn4ag0TavNly8cnUdQ=" style="color: blue; text-decoration: underline;" class=""><span style="font-size: 10.5pt; font-family: Helvetica, sans-serif;" class="">https://doi.org/10.1371/journal.pcbi.1002202</span></a><o:p class=""></o:p></div>
</div>
</blockquote>
</div>
<div style="margin: 0cm; font-size: 11pt; font-family: Calibri, sans-serif;" class="">
<o:p class=""> </o:p></div>
</div>
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C2ec1369abe884e94f77b08dc272614bc%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638428291706280140%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=KBnbW5%2BUEvjtG%2FiHouM9JXg3s0Yw7741WlrycIFCQvM%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" shash="U+/gv3kRsTRMMYUOmntE5qBjpS5wGG9S+3yTyS7+RvsBnnpzip8jxmz2dRWXwxXOWh0yW7fH7dEVqgvHzR7jT1VH+7UMkVJ1ML8NKV/QnAEx09QUdqVHjTD6Tx1y2lEOSI9LNXLurxVOoZS9SjDIkztQjcttLfYxKTZAhsaTJ10=" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C2ec1369abe884e94f77b08dc272614bc%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638428291706280140%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=exjaETWK2S7zhJ1G46hBhhhEO5GlwPtGlH53%2FE3%2FwFQ%3D&reserved=0" originalsrc="https://doi.org/10.1371/journal.pcbi.1002202" shash="mx3V5cFP5mqHyRnRJ0vc+WZLD2IwN9CHwnJpsrqVbnyc/5qkrm3xLOqiUxjsJQ6tYYPSG3ItesSR0rSLHe0sO/H6ZY3Su0Xae7oKzc+jfh3YGXzGV8XKq/X56n1uVbrPYtCMBTX33cEBxJrfKGmRiCDwiWIznl803ZqPDa0M9Kg=" style="color: blue; text-decoration: underline; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>