<div dir="ltr">
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Dear all,</span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">I would like to apply the ft_megrealign function to
MEG data.</span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">First I tried this:</span><span style="font-size:10pt;line-height:115%;font-family:"Arial","sans-serif";color:black" lang="EN-US"> </span><span style="font-family:"Arial","sans-serif"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black"><span style="mso-spacerun:yes"> </span>cfg<span style="mso-spacerun:yes"> </span>= [];</span><span style="font-size:12pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black"><span style="mso-spacerun:yes"> </span>cfg.vol.r<span style="mso-spacerun:yes"> </span>= 12;</span><span style="font-size:12pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black"><span style="mso-spacerun:yes"> </span>cfg.vol.o<span style="mso-spacerun:yes"> </span>= [0, 0, 4];</span><span style="font-size:12pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black"><span style="mso-spacerun:yes"> </span></span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">cfg.template<span style="mso-spacerun:yes"> </span>= allsens;</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style="mso-spacerun:yes">
</span>cfg.channel<span style="mso-spacerun:yes"> </span>= {</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'MEG'</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">};</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style="mso-spacerun:yes">
</span>cfg.inwardshift =<span style="mso-spacerun:yes"> </span>1;</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style="mso-spacerun:yes">
</span>cfg.headshape<span style="mso-spacerun:yes"> </span>= </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'hs_file'</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">;</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">new_data = ft_megrealign(cfg, old_data);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-family:"Arial","sans-serif";color:black" lang="EN-US">Then I got the following error message:</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">At
compilation, "template" was determined to be a variable and this
variable is<br>
uninitialized. "template" is also a function name and previous
versions of MATLAB would<br>
have called the function. However, MATLAB 7 forbids the use of the same name in
the same<br>
context as both a function and a variable.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;text-align:justify;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">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):</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="mso-ansi-language:EN-US" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">Ntp_avg = length(cfg.template);</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:blue" lang="EN-US">for</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"> i=1:Ntp_avg</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style="mso-spacerun:yes"> </span></span><span style="font-size:10pt;font-family:"Courier New";color:blue" lang="EN-US">if</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"> ischar(cfg.template{i}),</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style="mso-spacerun:yes"> </span>fprintf(</span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'reading template sensor position from %s\n'</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">, cfg.template{i});</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style="mso-spacerun:yes"> </span>tp_avg(i) =
ft_read_sens(cfg.template{i});</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style="mso-spacerun:yes"> </span></span><span style="font-size:10pt;font-family:"Courier New";color:blue" lang="EN-US">elseif</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"> isstruct(cfg.template{i}) &&
isfield(cfg.template{i}, </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'coilpos'</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">) && isfield(cfg.template{i}, </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'coilori'</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">)
&& isfield(cfg.template{i}, </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'tra'</span><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US">),</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style="mso-spacerun:yes"> </span>tp_avg(i) = cfg.template{i};</span><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:black" lang="EN-US"><span style="mso-spacerun:yes"> </span></span><span style="font-size:10pt;font-family:"Courier New";color:blue">end</span><span style="font-size:12pt;font-family:"Courier New""></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:10pt;font-family:"Courier New";color:blue">end</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif""> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">No I get an error
message, that “the variable tp_avg is not defined”.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Do I forget
something? Or do anyone have an other solution for the problem?</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">I would
appreciate any help / ideas!</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Thanks in
advance!</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US"> </span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Best,</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Daria <span style="mso-spacerun:yes"> </span><span style="mso-spacerun:yes"> </span><span style="mso-spacerun:yes"> </span><span style="mso-spacerun:yes"> </span></span></p>
</div>