[FieldTrip] ft_freqanalysis error

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Tue Jun 4 08:58:40 CEST 2019


Hi Sarah,

cfg.trials should be a numeric array, not a cell-array: in your case, when you use cfg.trials = groups{igroup} it will not work.
JAn-Mathijs


On 3 Jun 2019, at 18:05, Sarah Gerson <GersonS at cardiff.ac.uk<mailto:GersonS at cardiff.ac.uk>> wrote:

Dear Jan-Mathijs,

Good questions I checked and they all have at least some cells:

groups =

  1×3 cell array

    {7×1 cell}    {7×1 cell}    {4×1 cell}

I also tried starting with groupi = 2 to ensure it’s not just a problem with the first array, but I received the same error.

Best,
Sarah
—
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.



On 3 Jun 2019, at 15:43, Schoffelen, J.M. (Jan Mathijs) <jan.schoffelen at donders.ru.nl<mailto:jan.schoffelen at donders.ru.nl>> wrote:

Dear Sarah,

Hmm, hard to tell. Have you checked whether any of the cells in the variable ‘groups’ is empty? Does it happen for each of the ‘groupi’ iterations? Are the elements in groups of type numeric?

Best wishes,
Jan-Mathijs


On 31 May 2019, at 11:53, Sarah Gerson <GersonS at cardiff.ac.uk<mailto:GersonS at cardiff.ac.uk>> wrote:

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.



_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=01%7C01%7CGersonS%40cardiff.ac.uk%7C0c9a29b5139f4b0787df08d6e836a673%7Cbdb74b3095684856bdbf06759778fcbc%7C1&sdata=a5tf8BebnDHiY70mJj%2BBqE91FkYv10gGckqOD%2Bpyn6A%3D&reserved=0>
https://doi.org/10.1371/journal.pcbi.1002202

_______________________________________________
fieldtrip mailing list
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=01%7C01%7CGersonS%40cardiff.ac.uk%7C0c9a29b5139f4b0787df08d6e836a673%7Cbdb74b3095684856bdbf06759778fcbc%7C1&sdata=a5tf8BebnDHiY70mJj%2BBqE91FkYv10gGckqOD%2Bpyn6A%3D&reserved=0
https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=01%7C01%7CGersonS%40cardiff.ac.uk%7C0c9a29b5139f4b0787df08d6e836a673%7Cbdb74b3095684856bdbf06759778fcbc%7C1&sdata=PqlI0Im4FjTsdvOl3vXTOwRq1Vytd6%2FdF%2B%2F6zMS98Rk%3D&reserved=0

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20190604/a630fc50/attachment-0002.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