title: Constrain values in matlab
body: <p>If i have a simple array in matlab, say:</p>
  
  <pre><code>a = [0 1 2 3 4 5 6 0 0]
  </code></pre>
  
  <p>How do i constrain the values in that array (if for example i want the maximum value to be 1, so to get to: </p>
  
  <pre><code>a = [0 1 1 1 1 1 1 0 0]
  </code></pre>
  
  <p>What would be the simplest, most efficient way to do that?</p>