<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div apple-content-edited="true">Hi Mats,

</div><div apple-content-edited="true">this is expected behavior of ft_appenddata. Since a mismatch between head position and sensors is expected in the context of different datasets or sessions these shouldn’t be combined. Therefore you loos that information. Why don’t you go all the way down to the output of the frequency analysis and combine (e.g. grand average) the three separate structures?</div><div apple-content-edited="true">best</div><div apple-content-edited="true">tzvetan</div><div apple-content-edited="true"><br></div><div apple-content-edited="true"><br></div><div><blockquote type="cite"><div fpstyle="1" ocsi="0" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="direction: ltr; font-family: Tahoma; font-size: 10pt;"><span style="font-size: 13.3333330154419px;">Hi fieldtrippers,</span><div style="font-size: 13.3333330154419px;"><br></div><div style="font-size: 13.3333330154419px;"><br></div><div style="font-size: 13.3333330154419px;">I am stuck combining datasets from MEG sessions (note that I do this after preprocessing each individual dataset). I use ft_appenddata to combine the three datasets, which all have a different amount of trials and often there is a discrepency in the channels as well. After running the following code the alldata structure contains only the channels which are presents in all inputs, but the grad field (which is in the single datasets) is not in the combined datastructure:</div><div style="font-size: 13.3333330154419px;"><br></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="font-size: 13.3333330154419px;"><i>cfg=[];</i></div><div style="font-size: 13.3333330154419px;"><i>alldata = ft_appenddata(cfg, data{1}, data{2}, data{3})</i></div></blockquote><div style="font-size: 13.3333330154419px;"><br></div><div style="font-size: 13.3333330154419px;">If I try to use alldata (w/o .grad), I later run into problems using ft_megplanar when I want to do time-frequency analysis. The error is caused by ft_checkdata:</div><div style="font-size: 13.3333330154419px;"><br></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="font-size: 13.3333330154419px;"><i>Error using ft_checkdata (line 527)</i></div><div style="font-size: 13.3333330154419px;"><i>This function requires MEG data with a 'grad' field</i></div></blockquote><div style="font-size: 13.3333330154419px;"><i><br></i></div><div style="font-size: 13.3333330154419px;">I already tried solving this by using ft_average_sens:</div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="font-size: 13.3333330154419px;"><i>for ii=1:length(data)</i></div><div style="font-size: 13.3333330154419px;"><i>   sens(ii) = data{ii}.grad;</i></div><div style="font-size: 13.3333330154419px;"><i>end</i></div><div style="font-size: 13.3333330154419px;"><i>alldata.grad = ft_average_sens(sens);</i></div></blockquote><div style="font-size: 13.3333330154419px;"><i><br></i></div><div style="font-size: 13.3333330154419px;">However, than I get this error:</div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div style="font-size: 13.3333330154419px;"><div style="font-style: italic; font-size: 13.3333330154419px;">Error using ft_average_sens (line 101)</div></div><div style="font-size: 13.3333330154419px;"><div style="font-style: italic; font-size: 13.3333330154419px;">all sensor arrays should have the same sensors for averaging</div></div></blockquote><div style="font-size: 13.3333330154419px;"><div style="font-style: italic; font-size: 13.3333330154419px;"><br></div><div style="font-size: 13.3333330154419px;">How can I incorporate the grad field while I have different channels in each dataset?</div><div style="font-size: 13.3333330154419px;"><br></div><div style="font-size: 13.3333330154419px;"><br></div><div style="font-size: 13.3333330154419px;">Best,</div><div style="font-size: 13.3333330154419px;">Mats van Es</div></div><div style="font-size: 13.3333330154419px;"><br></div><div style="font-size: 13.3333330154419px;"><i><br></i></div><div style="font-size: 13.3333330154419px;"><br></div><div style="font-size: 13.3333330154419px;"><br></div></div>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></div></blockquote></div><br></body></html>