title: MATLAB find references to function
body: <p>MATLAB has some great tools, among which <a href="http://www.mathworks.com/help/matlab/ref/matlab.codetools.requiredfilesandproducts.html" rel="nofollow">this dependency listing function</a> stands out. I'm wondering, is there a way to perform the inverse operation?</p>
  
  <p>That is, <code>fList = matlab.codetools.requiredFilesAndProducts(files)</code> takes a function or script and returns a list of all of the dependencies. I am trying to do the opposite: given a function, I want to find all the functions where this function is called, perhaps limited to the scope of my working directory.</p>
  
  <p>The only solution I can think of is a brute force approach (which would be <em>painfully</em> slow given the speed of <code>matlab.codetools.requiredFilesAndProducts</code>). In MATLAB-esque pseudocode:</p>
  
  <pre><code>foi = file of interest
  files = empty set of file lists
  i = 0;
  for all files f in dir
      files{i} = matlab.codetools.requiredFilesAndProducts(f);
      i = i + 1;
  end
  find indices in files where list contains foi
  </code></pre>
  
  <p>Surely there must be better way.</p>