title: How to avoid a nested for loop in Matlab?
body: <p>If I have : </p>
  
  <pre><code>for i=1:n
      for j=1:m
          if outputImg(i,j) &lt; thresholdLow
              outputImg(i,j) = 0;
          elseif outputImg(i,j)&gt; thresholdHigh
              outputImg(i,j) = 1;
          end
      end
  end
  </code></pre>
  
  <p>or even worse : </p>
  
  <pre><code>for i=1:n
      for j=1:m
          for k=1:q
                  % do something  
          end
      end
  end
  </code></pre>
  
  <p>How can I achieve this differently , without <code>for</code> ?</p>