title: Access data files from subfolder of current script directory
body: <p>I have been working on MATLAB scripts.
  Basically, I have a lot of functions and data files (collectively known as kernels):</p>
  
  <p>I want to organize it a little bit. 
  The idea is </p>
  
  <ol>
  <li>to create a subfolder named <code>functions</code> and save all functions in it. </li>
  <li>Another <code>kernels</code> and save all data kernel files in it.</li>
  </ol>
  
  <p>Later by adding these paths at runtime, all the scripts should be able to access these functions and kernels without giving the full path to them, i.e. The script should search it in the subfodlers too.</p>
  
  <p>Applying <code>addpath(genpath(pwd));</code> worked for functions but it couldn't access kernel files</p>
  
  <p>e.g. What if I want to access file named <code>naif0010.tls</code> inside subfolder <code>kernels</code>. </p>
  
  <p>It didn't work. Any suggestions.</p>
  
  <p>Example:</p>
  
  <pre><code>% Add the current script directory and subfolders to search path
  addpath(genpath(pwd));
  
  % Load NASA Spice (mice) to the script here
  % add MICE reference path to MATLAB
  addpath('C:\Program Files\MATLAB\R2012b\extern\mice\src\mice');
  addpath('C:\Program Files\MATLAB\R2012b\extern\mice\lib');
  
  % Load leap second kernel
  % If the leapsecond kernel is placed in script directory
  % This file is present in pwd/kernel/naif0010.tls
  cspice_furnsh('naif0010.tls'); 
  </code></pre>