title: How do I do 2D logical array indexing in a 3D matrix?
body: <pre><code>TEMP = taux(LAT &lt; 0 &amp; LAT &gt; -9 &amp; LON &lt; 90 &amp; LON &gt; 70,timeIndex);
  </code></pre>
  
  <p>outputs this wonderful error: </p>
  
  <pre><code>Index exceeds matrix dimensions.
  
  taux is 360x160x192.
  </code></pre>
  
  <p>LAT is <strong>160x360</strong>, as is <strong>LON</strong>. timeIndex is <strong>192x1</strong> (it's an index of values for which time is between 1998 and 1999, for example)</p>
  
  <p>Even if I invert the matrix or try the following, the error still exists.</p>
  
  <pre><code>TEMP = taux((LAT &lt; 0 &amp; LAT &gt; -9 &amp; LON &lt; 90 &amp; LON &gt; 70)',timeIndex)
  </code></pre>
  
  <p><strong>OR</strong></p>
  
  <pre><code>TEMP = taux(LAT &lt; 0 &amp; LAT &gt; -9 &amp; LON &lt; 90 &amp; LON &gt; 70,LAT &lt; 0 &amp; LAT &gt; -9 &amp; LON &lt; 90 &amp; LON &gt; 70,timeIndex);
  </code></pre>