<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Dear Mushfa,<br>
      <br>
      I never tried what you did, however from what I know of the matter
      and from what Robert wrote, I can see that you made some errors in
      your script that I can point to. I can, however, neither guarantee
      that this solves all or any of your problems nor that it's all
      correct what you are doing. So, I can only tell you some  minor
      things:<br>
      1) When defining trial, setting cfg.trialdef.eventtype to '?'
      should actually only be done if you do not know the eventtype.
      Also note that it might be better to use all your trials rather
      than a subset - better signal-to-noise that way ;)<br>
      <br>
      2) No reason to segment the brain twice - this operation should be
      done only once and the segmented brain you base the two
      leadfield-matrices on *must* be exactly the same. So you can save
      time by removing the computation of vol2.<br>
      <br>
      3) Specifying only one frequency might not be a good idea, because
      of imperfect sampling.<br>
      <br>
      4) 'singlesphere' is created specifically for MEG data. BEM models
      are good for EEG, not sure how good they are for MEG, but the
      dipoli implementation only works under unix (Linux/Mac) and
      openMEEG has to be downloaded manually first to make it work.<br>
      <br>
      5) As Robert said, units are not always properly controlled for
      using FieldTrip. You can use ft_convert_units to make them match.<br>
      <br>
      6) Please check again how 'grid' is defined, e.g. the .dim field
      shouldn't be concatenated.<br>
      <br>
      7) You do not only need to concatenate the grids, but also the
      data, hope you did that ;) But I would really rather concatenated
      the two freq structures you used to compute the
      sourcemodel/leadfield than to compute it newly. If you concatenate
      you can be sure that the channel order is persistent.<br>
      <br>
      <br>
      If you keep on having problems, I would suggest to use breakpoints
      or <small><i>dbstop if error</i></small> and then step through
      the function to see where the error comes from, i.e. why there are
      NaNs or Infs in (lf*Cf*lf), and start off with looking at if there
      are NaNs or Infs in lf or Cf already. That's all I can help you
      with, cause that's were my knowledge ends ;) Maybe someone else is
      wiser than I am. Good luck!<br>
      <br>
      Best,<br>
      Jörn<br>
      <br>
      On 3/8/2013 4:12 PM, Mushfa Yousuf wrote:<br>
    </div>
    <blockquote
cite="mid:CAFy9vnLSPQDRaCQs8ajkSLfu_Ww7ZMyFRSoNVR3ZfmGp3Zb_BQ@mail.gmail.com"
      type="cite">
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">Hello;</span></p>
      <p class="MsoNormal" style="line-height:200%">
        <span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">I have few
          problems while calculating combine “MEG & EEG” source
          reconstruction and I need your help to troubleshoot the
          problems.</span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">I have a data
          from a Parkinson’s disease patient who underwent DBS and
          we recorded 306 MEG channels and 64 EEG channels
          simultaneously, first I have
          calculated the leadfield individually for both EEG and MEG. </span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">I have defined
          all the calculations step by step so that I can describe
          my problems very precisely.  </span></p>
      <p class="MsoNormal" style="line-height:200%"><b><u><span
              style="font-size:12.0pt;line-height:200%;font-family:"Times
              New Roman","serif"" lang="EN-US">CALCULATE
              THE
              LEADFIELD FOR MEG CHANNELS:-</span></u></b></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">// I have
          defined the Pre-Stimulus data i.e. Stim-off data in the
          original code.</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif"" lang="EN-US">Reading raw data
            set for MEG channels</span></u></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif"" lang="EN-US"> </span></u></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = [];                                           </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.dataset 
          = ‘</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">ap_rest_stimon_bi_2_5ma.fif'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;      
        </span><span style="font-size:12.0pt;font-family:"Courier
          New"" lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trialdef.eventtype     
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'?'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trialdef.triallength
          = 1;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trialdef.poststim      
          = 88;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = ft_definetrial(cfg);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trl
          = cfg.trl(1:88,:);   //
          Read 88 trials </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.channel  
          = {</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'MEG'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">};    
        </span><b><span style="font-size:12.0pt;font-family:"Times
            New Roman","serif"" lang="EN-US">// In order
            to read raw data only for MEG channels</span></b><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">  
        </span><span style="font-size:10.0pt;font-family:"Courier
          New";color:forestgreen" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">dataFIC12
          = ft_preprocessing(cfg);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">After that I
          have defined the <u>time of window of interest</u> for the
          MEG raw data set</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.toilim
          = [0 0.5];                       </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">dataPost
          = ft_redefinetrial(cfg, dataFIC12);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">and calculate
          the <u>Power Spectral density matrix</u> for the MEG
          channels data set</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = [];</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.method   
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'mtmfft'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.output   
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'powandcsd'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.tapsmofrq
          = 2;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.foilim   
          = [129 129];  </span><span
          style="font-size:12pt;font-family:'Times New Roman',serif"
          lang="EN-US">// Frequency of interest is 129 Hz the
          stimulation frequency </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.pad
          = 1;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">freqPost
          = ft_freqanalysis(cfg, dataPost);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">Now next step
          for me is to choose the method for the Head Model. I have
          noticed that Singlesphere is the common method which can be
          used for both EEG
          and MEG. So I have selected the singlesphere method for the
          calculation of
          volume conduction model.</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">mri
          = ft_read_mri(‘</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">ms1879865-0004-00001-000192-01.img'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">);
          // READ MRI</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = [];</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.write     
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'no'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.coordsys  
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'ctf'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">segmentedmri1
          = ft_volumesegment(cfg, mri); // Calculate the segmented
          mri</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = [];</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.method
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'singlesphere'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;
          // </span><b><span style="font-size:10pt;font-family:'Times
            New Roman',serif" lang="EN-US">METHOD</span></b><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">
        </span><span style="font-size:12.0pt;font-family:"Courier
          New"" lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">vol1
          = ft_prepare_headmodel(cfg, segmentedmri1);</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12pt;font-family:'Times New Roman',serif"
          lang="EN-US">Now next step is to calculate the LEADFIELD </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12pt;font-family:'Times New Roman',serif"
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg                
          = [];</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.grad           
          =
          freqPost.grad;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.vol            
          = vol1;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.reducerank     
          = 2;    // MEG</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.channel        
          = {</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'MEG'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">};
        </span><span style="font-size:12.0pt;font-family:"Courier
          New"" lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.grid.resolution
          = 1; // I choose a resolution 1</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:forestgreen" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">[grid1]
          = ft_prepare_leadfield(cfg);</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">disp(grid1)</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        xgrid:
            [-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        ygrid:
            [-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        zgrid:
            [-4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          dim:
            [15 16 16]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          pos:
            [3840x3 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">         unit:
            'cm'</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">       inside:
            [1x2037 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">      outside:
            [1x1803 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          cfg:
            [1x1 struct]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">    leadfield:
            {1x3840 cell}</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US"> </span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US"> </span></b></p>
      <p class="MsoListParagraph" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:Wingdings" lang="EN-US">Ø<span
            style="font-size:7pt;font-family:'Times New Roman'">  </span></span><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif"" lang="EN-US">It has to be
          noticed that Inside Dipole is 2037.</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US"> </span></b></p>
      <p class="MsoNormal" style="line-height:200%"><b><u><span
              style="font-size:12.0pt;line-height:200%;font-family:"Times
              New Roman","serif"" lang="EN-US">CALCULATE
              THE
              LEADFIELD FOR EEG CHANNELS:-</span></u></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif"" lang="EN-US">Reading raw data
            set for EEG channels</span></u></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif"" lang="EN-US"> </span></u></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = [];                                           </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.dataset 
          = ‘</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">ap_rest_stimon_bi_2_5ma.fif'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;      
        </span><span style="font-size:12.0pt;font-family:"Courier
          New"" lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trialdef.eventtype     
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'?'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trialdef.triallength
          = 1;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trialdef.poststim      
          = 88;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = ft_definetrial(cfg);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trl
          = cfg.trl(1:88,:);   //
          Read 88 trials </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.channel  
          = {</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'EEG'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">};    
        </span><b><span style="font-size:12.0pt;font-family:"Times
            New Roman","serif"" lang="EN-US">// In order
            to read raw data only for EEG channels</span></b><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">  
        </span><span style="font-size:10.0pt;font-family:"Courier
          New";color:forestgreen" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">dataFIC12
          = ft_preprocessing(cfg);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">After that I
          have defined the <u>time of window of interest</u> for the
          EEG raw data set</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.toilim
          = [0 0.5];                       </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">dataPost
          = ft_redefinetrial(cfg, dataFIC12);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">and calculate
          the <u>Power Spectral density matrix</u> for the EEG
          channels data set</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = [];</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.method   
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'mtmfft'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.output   
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'powandcsd'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.tapsmofrq
          = 2;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.foilim   
          = [129 129];  </span><span
          style="font-size:12pt;font-family:'Times New Roman',serif"
          lang="EN-US">// Frequency of interest is 129 Hz</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.pad
          = 1;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">freqPost
          = ft_freqanalysis(cfg, dataPost);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif"" lang="EN-US">HEAD MODEL FOR
            EEG</span></u></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif"" lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">mri
          = ft_read_mri(‘</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">ms1879865-0004-00001-000192-01.img'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = [];</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.write     
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'no'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.coordsys  
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'ctf'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">segmentedmri2
          = ft_volumesegment(cfg, mri);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = [];</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.method
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'singlesphere'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">; 
          // METHOD</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">vol2
          = ft_prepare_headmodel(cfg, segmentedmri2);</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span
            style="font-size:12pt;font-family:'Times New Roman',serif"
            lang="EN-US">LEADFIELD:</span></u><u><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif"" lang="EN-US"></span></u></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg           
          = [];</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.elec      
          = freqPost.elec; </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.vol       
          = vol2;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.reducerank
          = 3;     </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:forestgreen" lang="EN-US">% 3 for EEG</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.channel   
          = {</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'EEG'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">};</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.grid.resolution
          = 9.54;   </span><span
          style="font-size:12pt;font-family:'Times New Roman',serif"
          lang="EN-US">// Increase the resolution so that the
          inside dipoles for </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12pt;font-family:'Times New Roman',serif"
          lang="EN-US">                                                              
EEG
          should be close to the inside dipoles of
          MEG                                                      
        </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif"" lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">[grid2]
          = ft_prepare_leadfield(cfg);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">disp(grid2)</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        xgrid:
            [1x16 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        ygrid:
            [1x16 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        zgrid:
            [1x13 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          dim:
            [16 16 13]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          pos:
            [3328x3 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">         unit:
            'mm'</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">       inside:
            [1x2038 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">      outside:
            [1x1290 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          cfg:
            [1x1 struct]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">    leadfield:
            {1x3328 cell}</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoListParagraph" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:Wingdings" lang="EN-US">Ø<span
            style="font-size:7pt;font-family:'Times New Roman'">  </span></span><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif"" lang="EN-US">It has to be
          noticed that Inside Dipole is 2038.</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="line-height:200%"><b><u><span
              style="font-size:12.0pt;line-height:200%;font-family:"Times
              New Roman","serif"" lang="EN-US">Concatenate
              of
              MEG and EEG LEADFIELD:-</span></u></b></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">Now I have the
          individual LEADFIELD of both MEG and EEG grid1 and grid2
          respectively.</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">disp(grid1)</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        xgrid:
            [-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        ygrid:
            [-7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        zgrid:
            [-4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          dim:
            [15 16 16]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          pos:
            [3840x3 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">         unit:
            'cm'</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">       inside:
            [1x2037 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">      outside:
            [1x1803 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          cfg:
            [1x1 struct]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">    leadfield:
            {1x3840 cell}</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US"> </span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">disp(grid2)</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        xgrid:
            [1x16 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        ygrid:
            [1x16 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">        zgrid:
            [1x13 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          dim:
            [16 16 13]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          pos:
            [3328x3 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">         unit:
            'mm'</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">       inside:
            [1x2038 double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">      outside: [1x1290
            double]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">          cfg:
            [1x1 struct]</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">    leadfield:
            {1x3328 cell}</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US"> </span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">Few things to be noticed here </span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US"> </span></b></p>
      <p class="MsoListParagraphCxSpFirst"
        style="margin-bottom:0.0001pt"><span
          style="font-size:10.0pt;font-family:Wingdings" lang="EN-US">Ø<span
            style="font-size:7pt;font-family:'Times New Roman'">  </span></span><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">unit is different for both
            MEG ‘cm’ and EEG ‘mm’</span></b></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><span
          style="font-size:10.0pt;font-family:Wingdings" lang="EN-US">Ø<span
            style="font-size:7pt;font-family:'Times New Roman'">  </span></span><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">I have used the same method
            for calculating the Volume for both MEG & EEG =>
            “Singlesphere” </span></b></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:Wingdings" lang="EN-US">Ø<span
            style="font-size:7pt;font-family:'Times New Roman'">  </span></span><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">Concatenating the “pos”
            vector of EEG and MEG and the other vectors</span></b><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif"" lang="EN-US"></span></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US"> </span></b></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">Grid.pos
            = cat(1,grid1.pos,grid2.pos);</span></b></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">Grid.xgrid
            = [grid1.xgrid grid2.xgrid];</span></b></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">Grid.ygrid
            = [grid1.ygrid grid2.ygrid];</span></b></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">Grid.zgrid
            = [grid1.zgrid grid2.zgrid];</span></b></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">Grid.inside
            = [grid1.inside grid2.inside];</span></b></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">Grid.outside
            = [grid1.outside grid2.outside];</span></b></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""
            lang="EN-US">Grid.leadfield
            = [grid1.leadfield grid2.leadfield];</span></b></p>
      <p class="MsoListParagraphCxSpLast" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New"">Grid.dim
            = [grid1.dim grid2.dim];</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:10.0pt;font-family:"Courier New""> </span></b></p>
      <p class="MsoListParagraph" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif"">  </span></p>
      <p class="MsoNormal" style="line-height:200%"><b><u><span
              style="font-size:12.0pt;line-height:200%;font-family:"Times
              New Roman","serif"" lang="EN-US">Combined
              Source Reconstruction:-</span></u></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = [];                                           </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.dataset 
          = ‘</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">ap_rest_stimon_bi_2_5ma.fif'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;      
        </span><span style="font-size:12.0pt;font-family:"Courier
          New"" lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trialdef.eventtype     
          = </span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'?'</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trialdef.triallength
          = 1;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trialdef.poststim      
          = 88;</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg
          = ft_definetrial(cfg);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.trl
          = cfg.trl(1:88,:);   //
          Read 88 trials </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">cfg.channel  
          = {</span><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'MEG',’EEG’</span><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">};
        </span><b><span style="font-family:"Times New
            Roman","serif"" lang="EN-US">// In order to
            read raw data for MEG & EEG
            channels</span></b><span style="font-family:'Courier New'"
          lang="EN-US">   </span><span style="font-family:"Courier
          New";color:forestgreen" lang="EN-US"> </span><span
          style="font-family:"Courier New"" lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US">dataFIC12
          = ft_preprocessing(cfg);</span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10pt;font-family:'Courier New'" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">After that as
          previously defined, I have calculated the Spectral
          density. </span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">Now I have to
          calculate the inverse solution for both EEG & MEG data
          trials.</span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif"" lang="EN-US">Source Analysis:
            without contrasting condition:-</span></u></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><u><span
            style="font-size:12.0pt;font-family:"Times New
            Roman","serif"" lang="EN-US"> </span></u></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:10.0pt;font-family:"Courier
          New";color:forestgreen" lang="EN-US"> </span><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">cfg             
          = []; </span><span
          style="font-size:9.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">cfg.method      
          = </span><span
          style="font-size:9.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'dics'</span><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:9.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">cfg.frequency   
          = 129;  </span><span
          style="font-size:9.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">cfg.grid        
          = Grid;  // Concatenated grid</span><span
          style="font-size:9.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">cfg.vol         
          = vol1;  // As vol1 = vol2 : both singlesphere</span><span
          style="font-size:9.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">cfg.powmethod
          = </span><span
          style="font-size:9.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'trace'</span><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:9.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">cfg.dics.projectnoise
          = </span><span
          style="font-size:9.0pt;font-family:"Courier
          New";color:#a020f0" lang="EN-US">'yes'</span><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">;</span><span
          style="font-size:9.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">cfg.dics.lambda      
          = 0.0001;</span><span
          style="font-size:9.0pt;font-family:"Courier New""
          lang="EN-US"></span></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:9pt;font-family:'Courier New'" lang="EN-US">sourcePost_nocon
          = ft_sourceanalysis(cfg, freqPost); </span><span
          style="font-size:8pt;font-family:'Courier New'" lang="EN-US">//
        </span><b><span style="font-size:9pt;font-family:'Courier New'"
            lang="EN-US">freqpost contains both MEG </span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:9pt;font-family:'Courier New'" lang="EN-US">                                                       
and
            EEG row data</span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><b><span
            style="font-size:9pt;font-family:'Courier New'" lang="EN-US">                                                   
          </span></b><b><span
            style="font-size:9.0pt;font-family:"Courier New""
            lang="EN-US"></span></b></p>
      <p class="MsoNormal" style="margin-bottom:0.0001pt"><span
          style="font-size:12.0pt;font-family:"Courier New""
          lang="EN-US"> </span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">I have
          received the following error:</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif"" lang="EN-US">scanning grid
          2037/4075</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">???
          Error using
          ==> svd</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">Input to
          SVD must
          not contain NaN or Inf.</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US"> </span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">Error in
          ==>
          beamformer_dics>pinv at 568</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US"> 
          [U,S,V] = svd(A,0);</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US"> </span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">Error in
          ==>
          beamformer_dics at 314</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">       
          filt = pinv(lf' * invCf * lf) * lf' *
          invCf;              % Gross eqn. 3,</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">       
          use PINV/SVD to cover rank deficient
          leadfield</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US"> </span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">Error in
          ==>
          ft_sourceanalysis at 595</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">     
          dip(i) = beamformer_dics(grid, sens, vol,
          [],  squeeze(Cf(i,:,:)),</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">     
          optarg{:});</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US"> </span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">Error in
          ==>
          code at 227</span></p>
      <p class="MsoNoSpacing"><span
          style="font-size:12.0pt;font-family:"Times New
          Roman","serif";color:red" lang="EN-US">sourcePost_nocon
          =
          ft_sourceanalysis(cfg, freqPost);</span></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US"> </span></p>
      <p class="MsoListParagraphCxSpFirst" style="line-height:200%"><span
style="font-size:12.0pt;line-height:200%;font-family:Wingdings"
          lang="EN-US">Ø<span
            style="font-size:7pt;line-height:normal;font-family:'Times
            New Roman'">  </span></span><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">If you notice
          that till 2037 grid it represents the
          MEG grid and after that EEG grid is concatenated. i.e 2037
          +2038 = 4075 (which
          also represent inside dipole).</span></p>
      <p class="MsoListParagraphCxSpMiddle" style="line-height:200%"><span
style="font-size:12.0pt;line-height:200%;font-family:Wingdings"
          lang="EN-US">Ø<span
            style="font-size:7pt;line-height:normal;font-family:'Times
            New Roman'">  </span></span><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">Secondly I try
          to use other method for the head
          modeling i.e openmeeg, dipoli and bemcp method which leads me
          to different
          errors which I was unable to trouble shoot.</span></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-left:72.0pt;line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:Symbol"
          lang="EN-US">·<span
            style="font-size:7pt;line-height:normal;font-family:'Times
            New Roman'">        
          </span></span><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">Openmeeg
          = </span><span
          style="font-size:9.0pt;line-height:200%;font-family:"Lucida
          Console";color:red;background:white" lang="EN-US">OpenMEEG
binaries
          are not correctly installed</span><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US"></span></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-left:72.0pt;line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:Symbol"
          lang="EN-US">·<span
            style="font-size:7pt;line-height:normal;font-family:'Times
            New Roman'">        
          </span></span><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif";background:white"
          lang="EN-US">Dipoli =</span><span
          style="font-size:9.0pt;line-height:200%;font-family:"Lucida
          Console";background:white" lang="EN-US"> <span
            style="color:red">vol.mat file was missing after calculating
            the
            headmodel</span></span><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US"></span></p>
      <p class="MsoListParagraphCxSpMiddle"
        style="margin-left:72.0pt;line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:Symbol"
          lang="EN-US">·<span
            style="font-size:7pt;line-height:normal;font-family:'Times
            New Roman'">        
          </span></span><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif";background:white"
          lang="EN-US">Bemcp =</span><span
          style="font-size:9.0pt;line-height:200%;font-family:"Lucida
          Console";background:white" lang="EN-US"> <span
            style="color:red">vol.mat file contains NaN fiels which
            leads to
            wrong</span></span><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US"></span></p>
      <p class="MsoListParagraphCxSpLast"
        style="margin-left:72.0pt;line-height:200%"><span
          style="font-size:9.0pt;line-height:200%;font-family:"Lucida
          Console";color:red;background:white" lang="EN-US">        
          leadfield computation.</span><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US"></span></p>
      <p class="MsoNormal" style="line-height:200%"><b><u><span
              style="font-size:12.0pt;line-height:200%;font-family:"Times
              New Roman","serif"" lang="EN-US">I
              apologize for
              the long email. I wanted to show the steps which I used so
              that it is easier to
              debug the problem.</span></u></b></p>
      <p class="MsoNormal" style="line-height:200%"><b><u><span
              style="font-size:12.0pt;line-height:200%;font-family:"Times
              New Roman","serif"" lang="EN-US"> </span></u></b></p>
      <p class="MsoNormal" style="line-height:200%"><span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">Thank you;</span></p>
      <p class="MsoNormal" style="line-height:200%">
        <span
          style="font-size:12.0pt;line-height:200%;font-family:"Times
          New Roman","serif"" lang="EN-US">Mushfa Yousuf<br>
          <br>
          <br>
        </span></p>
      <br>
      <div class="gmail_quote">On Fri, Feb 8, 2013 at 2:36 PM, Robert
        Oostenveld <span dir="ltr"><<a moz-do-not-send="true"
            href="mailto:r.oostenveld@donders.ru.nl" target="_blank">r.oostenveld@donders.ru.nl</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div style="word-wrap:break-word">Dear Mushfa
            <div><br>
            </div>
            <div>In principle it can be made to work, but you'll have to
              do a little bit of  work outside fieldtrip. You would
              start with</div>
            <div>
              <div>1) ft_prepare_headmodel and ft_prepare_leadfield for
                the MEG part</div>
            </div>
            <div>
              <div>2) ft_prepare_headmodel and ft_prepare_leadfield for
                the EEG part</div>
            </div>
            <div>Subsequently you would (manually) concatenate the
              leadfields of the MEG and EEG. Here you have to make sure
              that the channel order is consistent with that in your
              combined data.</div>
            <div>The resulting structure with combined leadfields can be
              passed into ft_sourceanalysis as cfg.grid.</div>
            <div><br>
            </div>
            <div>However, I foresee a problem with the scaling. At this
              moment FieldTrip is not (yet) very precise in maintaining
              the correct units throughout. Consequently you might get
              different units for the EEG and MEG contribution to each
              dipole, causing weird cancelation effects. You'll just
              have to check carefully that the leadfield units and the
              data units consistently scaled between megmag, megplanar
              and eeg. </div>
            <div><br>
            </div>
            <div>This brings me to another known problem for the
              combined vectorview magnetometer and planar gradiometer
              channels: at this moment the forward computation computes
              both in T (or fT), whereas the data is represented as T
              for the magnetometers and T/m for the gradiometers. So the
              gradiometer leadfields are off by a factor "1/baseline",
              which is approximately 1/70 if I recall correctly. Many
              neuromag users use only the planar channels, and therefore
              don't notice. We are working on fixing the neuromag
              channel/gradiometer units. That is not as simple as it
              appears, because conversions of the geometrical dimensions
              from m to cm or mm also affect the gradiometer baseline.
              So converting the data from m to mm should result in the
              planar channel data getting 1000 times smaller, whereas
              the magnetometer channels shoudl stay the same. See <a
                moz-do-not-send="true"
                href="http://bugzilla.fcdonders.nl/show_bug.cgi?id=963"
                target="_blank">http://bugzilla.fcdonders.nl/show_bug.cgi?id=963</a>
              and <a moz-do-not-send="true"
                href="http://bugzilla.fcdonders.nl/show_bug.cgi?id=963"
                target="_blank">http://bugzilla.fcdonders.nl/show_bug.cgi?id=963</a> if
              you want to follow this.</div>
            <div><br>
            </div>
            <div>best regards</div>
            <div>Robert</div>
            <div><br>
            </div>
            <div><br>
            </div>
            <div>
              <div><br>
                <div>
                  <div>
                    <div class="h5">
                      <div>On 28 Jan 2013, at 20:20, Mushfa Yousuf
                        wrote:</div>
                      <br>
                    </div>
                  </div>
                  <blockquote type="cite">
                    <div>
                      <div class="h5">
                        <pre style="line-height:21px;color:rgb(68,68,68);font-size:15px;white-space:normal">Hello Fieldtrippers,

I am currently doing source analysis using beamformer method in fieldtrip.

The data i work on is a simultaneous measurement of MEG (306) with EEG
(128) on PD patients.

I was successful in calculating the sources for both the modalities alone.

I tried according the tutorial "Combined EEG and MEG source reconstruction" and was successful till the estimation


of the lead field. But, then when i want to use the created vol for the
source analysis i have two structures one for EEG and the second one for
MEG. Now, i can only define only one to estimate the sources. How to use


this for both the modalities? Any help would be appreciated.

With regards<font color="#888888">
Mushfa</font></pre>
                      </div>
                    </div>
                    _______________________________________________<br>
                    fieldtrip mailing list<br>
                    <a moz-do-not-send="true"
                      href="mailto:fieldtrip@donders.ru.nl"
                      target="_blank">fieldtrip@donders.ru.nl</a><br>
                    <a moz-do-not-send="true"
                      href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
                      target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></blockquote>
                </div>
                <br>
              </div>
            </div>
          </div>
          <br>
          _______________________________________________<br>
          fieldtrip mailing list<br>
          <a moz-do-not-send="true"
            href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a><br>
          <a moz-do-not-send="true"
            href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip"
            target="_blank">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br>
        </blockquote>
      </div>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
fieldtrip mailing list
<a class="moz-txt-link-abbreviated" href="mailto:fieldtrip@donders.ru.nl">fieldtrip@donders.ru.nl</a>
<a class="moz-txt-link-freetext" href="http://mailman.science.ru.nl/mailman/listinfo/fieldtrip">http://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a></pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Jörn M. Horschig
PhD Student
Donders Institute for Brain, Cognition and Behaviour 
Centre for Cognitive Neuroimaging
Radboud University Nijmegen 
Neuronal Oscillations Group
FieldTrip Development Team

P.O. Box 9101
NL-6500 HB Nijmegen
The Netherlands

Contact:
E-Mail: <a class="moz-txt-link-abbreviated" href="mailto:jm.horschig@donders.ru.nl">jm.horschig@donders.ru.nl</a>
Tel:    +31-(0)24-36-68493
Web: <a class="moz-txt-link-freetext" href="http://www.ru.nl/donders">http://www.ru.nl/donders</a>

Visiting address:
Trigon, room 2.30
Kapittelweg 29
NL-6525 EN Nijmegen
The Netherlands</pre>
  </body>
</html>