title: Calling a function in a separate function file - matlab
body: <p>From what I understood of matlab, if you want to define a function and use it in your "main file" you need to write the function in a separate file and to call it at the beginning of your "main file" with <code>addpath('...\myfunction.m')</code>.</p>
  
  <p>Now let's say I define a function <code>f1</code> in a file <code>f1.m</code> that I use in <code>main.m</code>, if I want to define a function <code>f2</code> (in another file) that needs to call <code>f1</code>, can I use <code>addpath()...\f1.m</code> in my <code>f2.m</code> file ? Or what is the best way of calling <code>f1</code> in <code>f2</code> ?</p>