<div dir="ltr">
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Dear Jörn,</span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US"><br></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">yes, I tried the latest version of FT – thank you for the advice!</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">The function works fine, when I leave out the cfg.headshape:</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-size:10pt;font-family:"Courier New";color:black"><span> </span>cfg = []; </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> </span>cfg.headmodel.r = 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> </span>cfg.headmodel.o = [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" lang="EN-US"><span> </span>cfg.template<span> </span>= sens_m;</span><span style="font-size:10pt;font-family:"Courier New";color:forestgreen" lang="EN-US"><span> </span></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> </span>cfg.channel<span> </span>= {'MEG'};</span><span style="font-size:12pt;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> </span>cfg.inwardshift =<span> </span>2.5;</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>
</span></span><span style="font-size:10pt;font-family:"Courier New";color:forestgreen">% cfg.headshape<span> </span>=
'hs_file';</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> </span><span lang="EN-US"><span> </span></span></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> </span>realigned_data=
ft_megrealign(cfg, input_data);</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 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">Unfortunately,I still get the following error message, after including
the cfg.headshape.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Reference to non-existent field 'xgrid'.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US">Error in ft_prepare_sourcemodel (line 665)</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif"" lang="EN-US"><span> </span>xmin_indx =
find(grid.xgrid==xmin);</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><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-family:"Arial","sans-serif"" lang="EN-US">I thought,
that something must be wrong with my headshape-file and tried the <span style="color:black">ft_prepare_sourcemodel-function and it’s fine:</span></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><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">shape = ft_read_headshape(</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><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> </span></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">cfg = [];</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">cfg.grid.pos = shape.pnt;</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">cfg.grid.xgrid<span> </span>= </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'auto'</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">cfg.grid.ygrid<span> </span>= </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)" lang="EN-US">'auto'</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">cfg.grid.zgrid<span> </span>= </span><span style="font-size:10pt;font-family:"Courier New";color:rgb(160,32,240)">'auto'</span><span style="font-size:10pt;font-family:"Courier New";color:black">;</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" lang="EN-US">grid = ft_prepare_sourcemodel(cfg, input_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;line-height:normal"><span style="font-family:"Arial","sans-serif";color:black" lang="EN-US">My
shape/grid-variable looks like this:</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif";color:black" lang="EN-US"> <img alt="Inline-Bild 1" src="cid:ii_14fdfbcdfa7ee4ef" height="190" width="233"></span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-family:"Arial","sans-serif";color:black" lang="EN-US"><br></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span></span><span style="font-family:"Arial","sans-serif";color:black" lang="EN-US"></span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US">Till
now I could not find the solution for the problem.</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US">Do
someone have an idea?</span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><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:12pt;font-family:"Courier New"" lang="EN-US">Thank
you very much in advance for your time!</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><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:12pt;font-family:"Courier New"" lang="EN-US">Best,</span></p>
<p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><span style="font-size:12pt;font-family:"Courier New"" lang="EN-US">Daria</span></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><br><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"><br></p><p class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal"><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:12pt;font-family:"Courier New"" lang="EN-US"><br></span></p>
</div><div class="gmail_extra"><br><div class="gmail_quote">2015-09-18 10:12 GMT+02:00 Jörn M. Horschig <span dir="ltr"><<a href="mailto:jorn@artinis.com" target="_blank">jorn@artinis.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-US"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="NL">Dear Daria,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d" lang="NL"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">have you tried the most recent version of FT? This should have been resolved there.<u></u><u></u></span></p><span class=""><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Best,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Jörn<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264">--<u></u><u></u></span></b></p><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255a9e"><u></u> <u></u></span></b></p><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255a9e">Jörn M. Horschig, PhD</span></b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264">, Software Engineer</span><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:black"><u></u><u></u></span></b></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264" lang="NL"><a href="http://www.artinis.com/" target="_blank"><span style="color:#626264" lang="EN-US">Artinis Medical Systems</span></a></span><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264"> | <a href="tel:%2B31%20481%20350%20980" value="+31481350980" target="_blank">+31 481 350 980</a> </span><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255a9e"><u></u><u></u></span></b></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"><u></u> <u></u></span></p></span><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a> [mailto:<a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a>] <b>On Behalf Of </b>Daria Laptinskaya<br><b>Sent:</b> Tuesday, September 15, 2015 11:36 AM<span class=""><br><b>To:</b> FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br></span><b>Subject:</b> Re: [FieldTrip] Problem with ft_megrealign<u></u><u></u></span></p></div></div><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Dear Jörn,<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">thank you very much for your helpful answer! I did not want to answer before running the function. First I got an error message with the notice that separate structures of the cfg.template could not be translated into a variable of the type double (template variable). Hence I defined the template variable as a cell-array: <u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black">Ntemplate = length(cfg.template);</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black">template = cell(Ntemplate, 1);</span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">and at the end did this: <u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black">j = 1;</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:blue">for</span><span style="font-size:10.0pt;font-family:"Courier New";color:black"> i=1:length(template)</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> eval([</span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'tp'</span><span style="font-size:10.0pt;font-family:"Courier New";color:black">, num2str(j), </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">' = template{1};'</span><span style="font-size:10.0pt;font-family:"Courier New";color:black">]) </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> j = j+1;</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:blue">end</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:blue"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black">template_new = ([tp1, tp2]);</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black">grad = ft_average_sens(template_new);</span><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal">Now it works fine, then I leave out the cfg.headshape = ‘hs_file’. Using this command is leading to the following error message: Reference to non-existent field 'xgrid'. I understand the message, but could not fix the problem till now. I could swear, it worked some time ago :). <u></u><u></u></p><p class="MsoNormal">I’m sorry to bother you with this, but I would appreciate, if you or someone else could give me a further tip, how to solve the problem.<u></u><u></u></p><p class="MsoNormal">Many thank in advance!<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Best, <u></u><u></u></p><p class="MsoNormal">Daria<u></u><u></u></p></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">2015-09-10 10:52 GMT+02:00 Jörn M. Horschig <<a href="mailto:jorn@artinis.com" target="_blank">jorn@artinis.com</a>>:<u></u><u></u></p><blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in"><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Dear Daria,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">try initializing </span><span style="font-family:"Arial",sans-serif">tp_avg </span><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">just before the for-loop, e.g. by set tp_avg = []</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">The error message you got means that you have a function called template somewhere in your path. In the command line, you can type </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">>> which template</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">to find out where function is located. Afaik it’s not a FieldTrip function. Anyway, to fix this, the template variable should have been initialized in the same vein as I described above. I’ll quickly fix this so that this does not happen anymore in the new version (from tomorrow onwards). </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">This means, also for you the fix would have been just to initialize the template variable rather than renaming the variable, but your solution also works fine after initializing the variable ;)</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Best,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d">Jörn</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264">--</span></b><u></u><u></u></p><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255a9e"> </span></b><u></u><u></u></p><p class="MsoNormal"><b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#255a9e">Jörn M. Horschig, PhD</span></b><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264">, Software Engineer</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264" lang="NL"><a href="http://www.artinis.com/" target="_blank"><span style="color:#626264" lang="EN-US">Artinis Medical Systems</span></a></span><span style="font-size:9.0pt;font-family:"Verdana",sans-serif;color:#626264"> | <a href="tel:%2B31%20481%20350%20980" target="_blank">+31 481 350 980</a> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1f497d"> </span><u></u><u></u></p><div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt"><div><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> <a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a> [mailto:<a href="mailto:fieldtrip-bounces@science.ru.nl" target="_blank">fieldtrip-bounces@science.ru.nl</a>] <b>On Behalf Of </b>Daria Laptinskaya<br><b>Sent:</b> Thursday, September 10, 2015 10:39 AM<br><b>To:</b> FieldTrip discussion list <<a href="mailto:fieldtrip@science.ru.nl" target="_blank">fieldtrip@science.ru.nl</a>><br><b>Subject:</b> [FieldTrip] Problem with ft_megrealign</span><u></u><u></u></p></div></div><div><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal"><span style="font-family:"Arial",sans-serif">Dear all,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif">I would like to apply the ft_megrealign function to MEG data.</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif">First I tried this:</span><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> cfg = [];</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> cfg.vol.r = 12;</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> cfg.vol.o = [0, 0, 4];</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> cfg.template = allsens;</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> cfg.channel = {</span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'MEG'</span><span style="font-size:10.0pt;font-family:"Courier New";color:black">};</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> cfg.inwardshift = 1;</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> cfg.headshape = </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'hs_file'</span><span style="font-size:10.0pt;font-family:"Courier New";color:black">;</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black">new_data = ft_megrealign(cfg, old_data);</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><u></u><u></u></p><p class="MsoNormal" style="text-align:justify"><span style="font-family:"Arial",sans-serif;color:black">Then I got the following error message:</span><u></u><u></u></p><p class="MsoNormal" style="text-align:justify"><span style="font-family:"Arial",sans-serif">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><u></u><u></u></p><p class="MsoNormal" style="text-align:justify"><span style="font-family:"Arial",sans-serif"> </span><u></u><u></u></p><p class="MsoNormal" style="text-align:justify"><span style="font-family:"Arial",sans-serif">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><u></u><u></u></p><p class="MsoNormal"> <u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black">Ntp_avg = length(cfg.template);</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:blue">for</span><span style="font-size:10.0pt;font-family:"Courier New";color:black"> i=1:Ntp_avg</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><span style="font-size:10.0pt;font-family:"Courier New";color:blue">if</span><span style="font-size:10.0pt;font-family:"Courier New";color:black"> ischar(cfg.template{i}),</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> fprintf(</span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'reading template sensor position from %s\n'</span><span style="font-size:10.0pt;font-family:"Courier New";color:black">, cfg.template{i});</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> tp_avg(i) = ft_read_sens(cfg.template{i});</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><span style="font-size:10.0pt;font-family:"Courier New";color:blue">elseif</span><span style="font-size:10.0pt;font-family:"Courier New";color:black"> isstruct(cfg.template{i}) && isfield(cfg.template{i}, </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'coilpos'</span><span style="font-size:10.0pt;font-family:"Courier New";color:black">) && isfield(cfg.template{i}, </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'coilori'</span><span style="font-size:10.0pt;font-family:"Courier New";color:black">) && isfield(cfg.template{i}, </span><span style="font-size:10.0pt;font-family:"Courier New";color:#a020f0">'tra'</span><span style="font-size:10.0pt;font-family:"Courier New";color:black">),</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> tp_avg(i) = cfg.template{i};</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> </span><span style="font-size:10.0pt;font-family:"Courier New";color:blue">end</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Courier New";color:blue">end</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif">No I get an error message, that “the variable tp_avg is not defined”.</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif">Do I forget something? Or do anyone have an other solution for the problem?</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif">I would appreciate any help / ideas!</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif">Thanks in advance!</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif"> </span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif">Best,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-family:"Arial",sans-serif">Daria </span><u></u><u></u></p></div></div></div></div></div></div><p class="MsoNormal"><br>_______________________________________________<br>fieldtrip mailing list<br><a href="mailto:fieldtrip@donders.ru.nl" target="_blank">fieldtrip@donders.ru.nl</a><br><a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></div><br>_______________________________________________<br>
fieldtrip mailing list<br>
<a href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
<a href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip" rel="noreferrer" target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br></blockquote></div><br></div>