title: Min / Max of 3d Matrix using different intervals Matlab
body: <p>I have a 3d matrix A of size MxNxZ. I am searching the minimum for each vector in the Z direction like this.</p>
  
  <pre><code>I = min(A(:, :, minInterval : maxInterval), [], 3);
  </code></pre>
  
  <p>This is working.</p>
  
  <p>Now I want to have variable intervals for each vector. I have then two 2d matrices as follow :</p>
  
  <pre><code>minIntervals of size MxN
  maxIntervals of size MxN
  </code></pre>
  
  <p>I am then trying this :</p>
  
  <pre><code>I = min(A(:, :, minIntervals : maxIntervals), [], 3);
  </code></pre>
  
  <p>but it did not work and use only minIntervals(1,1) and maxIntervals(1,1).</p>
  
  <p>Do you have an idea, I don't want to use loop because of the size of the data.</p>
  
  <p>Thank you very much.</p>