[FieldTrip] ft_freqanalysis error

Sarah Gerson GersonS at cardiff.ac.uk
Fri May 31 11:53:22 CEST 2019


Hi everyone,

I’m trying to revive an old processing script for TFRs on a new computer and am running into an error I can’t seem to track down.
I want to run ft_freqanalysis and am trying to use a data file that is the output of a preprocessing script that worked fine. As far as I can tell from the fieldtrip guidance/forum, the data structure should be fine, but I am receiving an error stating that it needs to be a cell array (among other errors).

Any help or guidance is greatly appreciated!

For reference, I’ll copy and paste the code that’s creating the error, the errors received, and the data file structure (since this seems to be a source of the error):

Code:
 for groupi = 1:3
    windowsize = 0.5;



      disp('----');       disp('----');
        disp(['loading data from subject ', num2str(subjects), ' || ', 'groups ', num2str(groupi)]);
        disp('----');       disp('----');



        cfg = [];
        cfg.trials         = groups{groupi}%(((length(groups{groupi})/2)+1):end);
        cfg.output         = 'pow';
        cfg.method         = 'mtmconvol'; %'mtmfft';
        cfg.channel         = {'all'}; %mtmfft
        cfg.taper          = 'hanning'; %'dpss';
        cfg.tapsmofrq      = 3;
        cfg.foi            = 1:50;
        cfg.t_ftimwin      =  ones(1, length(cfg.foi))*windowsize; % ones(length(cfg.foi),1).*0.5;
        cfg.toi            = [reref_datam{subject}.time{1}(1) + windowsize/2 : windowsize/5 : reref_datam{subjects}.time{1}(end) - windowsize/2] %0:0.1:2;
        TFR_cond{subjects, groupi}               = ft_freqanalysis(cfg, reref_datam{subjects});
        TFR_cond{subjects, groupi}.cfg = [];
    end;

Errors:

Error using sort
Input argument must be a cell array of character vectors.

Error in ft_selectdata>getselection_rpt (line 1128)
  rptindx = unique(sort(rptindx));

Error in ft_selectdata (line 302)
    [selrpt{i}, dum, rptdim{i}, selrpttap{i}] = getselection_rpt(cfg, varargin{i}, dimord{j});

Error in ft_freqanalysis (line 234)
data = ft_selectdata(tmpcfg, data);

Structure of data:
reref_datam{subjects}

ans =

  struct with fields:

           hdr: [1×1 struct]
       fsample: 500
    sampleinfo: [95×2 double]
     trialinfo: [95×1 double]
         trial: {1×95 cell}
          time: {1×95 cell}
         label: {31×1 cell}
           cfg: [1×1 struct]


—
Sarah A Gerson, PhD
Lecturer
School of Psychology
College of Biomedical & Life Sciences
Cardiff University
70 Park Place
Cardiff
CF10 3AT
Tel: +44 (0)29 2087 0480
Email: GersonS at cardiff.ac.uk<mailto:GersonS at cardiff.ac.uk>
http://psych.cf.ac.uk/contactsandpeople/gersons.php
The University welcomes correspondence in Welsh or English.
Sarah A Gerson, PhD
Darlithydd
Yr Ysgol Seicoleg
Coleg y Gwyddorau Biofeddygol a Bywyd
Prifysgol Caerdydd
70 Plas-y-Parc
Caerdydd
CF10 3AT
Ffôn : +44 (0)29 2087 0480
E-bost: GersonS at cardiff.ac.uk<mailto:GersonS at cardiff.ac.uk>
http://psych.cf.ac.uk/contactsandpeople/gersons.php
Mae'r Brifysgol yn croesawu gohebiaeth yn Gymraeg neu'n Saesneg.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190531/1d3d02d0/attachment-0001.html>
-------------- next part --------------
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202


More information about the fieldtrip mailing list