title: Matlab last dimension access on ndimensions matrix
body: <p>I have as entry a matrix which can have an several number of dimensions : <code>n × m</code> or <code>n × m × p</code> or <code>n × m × p × q</code> or ...</p>
  
  <p>What I want to do is to access to the last dimension, something like:</p>
  
  <pre><code>data = input(:,:,1)
  </code></pre>
  
  <p>The problem is that the number of <code>:</code> can change.</p>