title: How to get relative path to folder containing a .m file
body: <p>I write code where I load a lot of project data. I want to keep my pathnames in the code relative to some location of this project on the disk, i.e. not having it configured or hard-coded. </p>
  
  <p>Is there function in matlab to do some like this?</p>
  
  <p>In python I would write:</p>
  
  <pre><code>ROOT = os.path.dirname(__file__)
  </code></pre>