title: MATLAB- passing a function handle parameter into another function as a handle
body: <p>Working on an assignment involving Genetic Algorithms (loads of headaches, loads of fun). I need to be able to test differing crossover methods and differing mutation methods, to compare their results (part of the paper I have to write for the course). As such, I want to just pass the function names into the Repopulate method, as function handles.</p>
  
  <pre><code>function newpop = Repopulate(population, crossOverMethod, mutationMethod)
    ...
    child = crossOverMethod(parent1, parent2, @mutationMethod);
    ...
  
  function child = crossOverMethod(parent1, parent2, mutationMethod)
    ...
    if (mutateThisChild == true)
      child = mutationMethod(child);
    end
    ...
  </code></pre>
  
  <p>The key point here is like 3, parameter 3: how do I pass mutationMethod down another level? If I use the @ symbol, I get told: </p>
  
  <pre><code>"mutationMethod" was previously used as a variable,
   conflicting with its use here as the name of a function or command.
  </code></pre>
  
  <p>If I don't use the @ symbol, then mutationMethod gets called, with no parameters, and is quite unhappy.</p>
  
  <p>While I am aware that yes, I could just rewrite my code to make it work differently, I'm now curious as to how to make it actually <em>work</em>. </p>
  
  <p>Any help is greatly appreciated.</p>