title: Simulink: Get Path of Blocks Higher on the Hierarchy
body: <p>In <code>Matlab</code>, the <code>get_param</code> and <code>set_param</code> commands require the exact directory of a block.<br>
  The <code>gcb</code> command can give you the path of a currently selected block.<br>
  What is the best method to determine blocks paths relative to this block?</p>
  
  <p><em>For example</em>, relative path identifiers sometimes use periods.  </p>
  
  <p>To find the current path, use <code>'./'</code>.<br>
  To find the parent path, use <code>'../'</code>.<br>
  To find the parent of the parent, use <code>'../../'</code>.</p>
  
  <p>These do not function in conjunction with <code>gcb</code> however.</p>
  
  <h2>MWE</h2>
  
  <p>In <code>Simulink</code>, if I create a block and select it,<br>
  and then type into the <code>Matlab</code> window:</p>
  
  <p><code>get_param([gcb], 'ObjectParameters')</code></p>
  
  <p>I am provided with a list of block parameters,<br>
  any of which may be altered using <code>set_param([gcb], &lt;parameter&gt;, &lt;value&gt;)</code>.</p>
  
  <p>Included in the list of parameters is <code>Parent</code>, which provides the parent path.<br>
  Is there a command which can take a path and remove until the next <code>'/'</code>?<br>
  (Or more usefully, a command which acts as a reverse <code>fullfile</code>?)<br>
  (Someone mentioned regular expressions, so I'm looking into those.)</p>
  
  <p>Also, (less important to me, but for posterity),<br>
  is there a command which can find children paths?</p>