<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<div class="paragraphNode wrappable"><span class="textBox"><span class="textWrapper">Hello!</span></span></div>
<div class="paragraphNode wrappable"><span class="textBox"><span class="textWrapper"><br>
</span></span></div>
<div class="paragraphNode wrappable"><span class="textBox"><span class="textWrapper">I am analysing MEG data and have 20 participants, so 20 datasets. I want to append all these with ft_appenddata.</span></span></div>
<div class="paragraphNode wrappable"><span class="textBox"><span class="textWrapper">Is there a way to plug in all the variable names without having to manually spell out all of them?
<br>
</span></span></div>
<div class="paragraphNode wrappable"><span class="textBox"><span class="textWrapper">For example:</span></span></div>
<div class="CodeBlock contiguous">
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper">[appendeddata] = ft_appenddata(cfg, s(1).rawdata.data00,<span class="textBox"><span class="textWrapper">s(2).rawdata.data00</span></span>,
<span class="textBox"><span class="textWrapper">s(3).rawdata.data00</span></span>,</span><span class="textWrapper Keyword"> ...</span><span class="textWrapper Comment"> and so forth</span></span></div>
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper Comment"><br>
</span></span></div>
</div>
<div class="paragraphNode wrappable"><span class="textBox"><span class="textWrapper">So I would have to spell out all 20 names which is quite cumbersome. I tried to get around this by using sprinft like this:</span></span></div>
<div class="paragraphNode wrappable"><span class="textBox"><span class="textWrapper"><br>
</span></span></div>
<div class="CodeBlock contiguous">
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper">
<div>k=strings(1,20);<br>
k(1:20)=1:20;<br>
cfg=[];<br>
[appendeddata] = ft_appenddata(cfg,sprintf('s(%s).rawdata.data00,',k));<br>
<br>
</div>
</span></span></div>
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper"><br>
But if I do this, I get these errors:</span></span></div>
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper">
<div>Error using ft_checkdata (line 529)<br>
This function requires 'raw' or 'raw+comp' data as input, see ft_datatype_raw.<br>
<br>
Error in ft_appenddata (line 102)<br>
varargin{i} = ft_checkdata(varargin{i}, 'datatype', {'raw', 'raw+comp'}, 'feedback', 'no', 'hassampleinfo', cfg.keepsampleinfo);</div>
<br>
</span></span></div>
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper">So I guess using sprintf doesn't work. Is there another way to put in several variables into ft_appenddata (or any other fieldtrip function) without
having to write them down myself?</span></span></div>
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper"><br>
</span></span></div>
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper">Thanks for your answers in advance!</span></span></div>
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper"><br>
</span></span></div>
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper">Kind regards</span></span></div>
<div class="lineNode mwRichTextComponentLine plainTextFixedSize"><span class="textBox"><span class="textWrapper">Erika<br>
</span></span></div>
</div>
</div>
</body>
</html>