[FieldTrip] help

Yee Wong ywong252 at uwo.ca
Fri Mar 26 20:58:09 CET 2021


Hello,

I am running into this warning (Warning: Iteration limit reached) with the rest analysis slope code below.

%% Create Slope Data

for subj = subj_list

    subject = subjname{subj};
    restdir  = [maindir subject '/rest/'];
    fftdir = [restdir 'fft/'];
    slopedir  = [restdir 'slope/'];
    if(exist(slopedir, 'dir') == 0)
        mkdir(slopedir);
    end
    cd(restdir);
    load([fftdir 'fft_rest_matched.mat'],'fft_car')

     % select channels
    cfg = [];
    cfg.channel = ft_channelselection({'F*','C*'}, fft_car.label);
    fft_car = ft_selectdata(cfg,fft_car);

    % determine frequency indices
    lf = find(30==round(fft_car.freq,0));
    hf = find(50==round(fft_car.freq,0));

   % compute slope
    for c=1:size(fft_car.powspctrm,2) % channel
        for tr=1:size(fft_car.powspctrm,1) % trial

            power = []; rfit = [];
            power = log10(squeeze(fft_car.powspctrm(tr,c,lf:hf)));
            rfit = robustfit(log10(fft_car.powspctrm(lf:hf)),power);
            slope_rest(c,tr) = rfit(2);

        end
    end

     % for each channel create average across trials
    for c = 1:size(slope_rest,1)
        slope_rest_avg(c,1) = mean(slope_rest(c,:),2);
    end

    filename = strcat('slope_rest_car.mat');
    save([slopedir filename],'slope_rest','slope_rest_avg');

    clear c tr fft_car slope_rest*

end

Any help would be appreciated.

Sincerely,


Michelle (Yee Suet) Wong
BHK, MSc, PhD Candidate
Western University
School of Kinesiology
Faculty of Health Sciences
Exercise, Mobility, and Brain Health Lab
London, Ontario, Canada


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20210326/1ef8d113/attachment.htm>


More information about the fieldtrip mailing list