title: Set all nonzero matrix elements to 1 (while keeping the others 0)
body: <p>I have a mesh grid defined as </p>
  
  <pre><code>[X, Y, Z] = meshgrid(-100:100, -100:100, 25); % z will have more values later
  </code></pre>
  
  <p>and two shapes (ovals, in this case):</p>
  
  <pre><code>x_offset_1 = 40;
  x_offset_2 = -x_offset_1;
  o1 = ((X-x_offset_1).^2./(2*Z).^2+Y.^2./Z.^2 &lt;= 1);
  o2 = ((X-x_offset_2).^2./(2*Z).^2+Y.^2./Z.^2 &lt;= 1);
  </code></pre>
  
  <p>Now, I want to find all points that are nonzero in <em>either</em> oval. I tried</p>
  
  <pre><code>union = o1+o2;
  </code></pre>
  
  <p>but since I simply add them, the overlapping region will have a value of 2 instead of the desired 1.</p>
  
  <p>How can I set <em>all</em> nonzero entries in the matrix to 1, regardless of their previous value?</p>
  
  <p>(I tried <code>normalized_union = union./union;</code>, but then I end up with <code>NaN</code> in all 0 elements because I'm dividing by zero...)</p>