[FieldTrip] Several variables as input into function without writing them manually?

Erika Puiutta erika.puiutta at uni-oldenburg.de
Tue Jul 16 12:06:21 CEST 2019


I am analysing MEG data and have 20 participants, so 20 datasets. I want to append all these with ft_appenddata.
Is there a way to plug in all the variable names without having to manually spell out all of them?
For example:
[appendeddata] = ft_appenddata(cfg, s(1).rawdata.data00,s(2).rawdata.data00, s(3).rawdata.data00, ... and so forth

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:

[appendeddata] = ft_appenddata(cfg,sprintf('s(%s).rawdata.data00,',k));

But if I do this, I get these errors:
Error using ft_checkdata (line 529)
This function requires 'raw' or 'raw+comp' data as input, see ft_datatype_raw.

Error in ft_appenddata (line 102)
  varargin{i} = ft_checkdata(varargin{i}, 'datatype', {'raw', 'raw+comp'}, 'feedback', 'no', 'hassampleinfo', cfg.keepsampleinfo);

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?

Thanks for your answers in advance!

Kind regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190716/f8df8a79/attachment-0001.html>
-------------- next part --------------
fieldtrip mailing list

More information about the fieldtrip mailing list