[FieldTrip] Problem with ft_megrealign

Daria Laptinskaya daria.laptinskaya at googlemail.com
Thu Sep 10 10:38:56 CEST 2015


Dear all,

I would like to apply the ft_megrealign function to MEG data.

First I tried this:

    cfg             = [];

    cfg.vol.r       = 12;

    cfg.vol.o       = [0, 0, 4];

    cfg.template    = allsens;

    cfg.channel     = {'MEG'};

    cfg.inwardshift =  1;

    cfg.headshape   = 'hs_file';



new_data = ft_megrealign(cfg, old_data);



Then I got the following error message:

At compilation, "template" was determined to be a variable and this
variable is
uninitialized. "template" is also a function name and previous versions of
MATLAB would
have called the function. However, MATLAB 7 forbids the use of the same
name in the same
context as both a function and a variable.



I thought that renaming the variable “template” would solve the problem and
did the following within the original function (replaced the
template-variable with the Ntp_avg variable):



Ntp_avg = length(cfg.template);

for i=1:Ntp_avg

  if ischar(cfg.template{i}),

    fprintf('reading template sensor position from %s\n', cfg.template{i});

    tp_avg(i) = ft_read_sens(cfg.template{i});

  elseif isstruct(cfg.template{i}) && isfield(cfg.template{i}, 'coilpos')
&& isfield(cfg.template{i}, 'coilori') && isfield(cfg.template{i}, 'tra'),

    tp_avg(i) = cfg.template{i};

  end

end



No I get an error message, that “the variable tp_avg is not defined”.

Do I forget something? Or do anyone have an other solution for the problem?



I would appreciate any help / ideas!



Thanks in advance!



Best,

Daria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20150910/e3f81ed2/attachment.html>


More information about the fieldtrip mailing list