title: Make sure nested loop variables have different values
body: <p>I want to create an adjacency matrix from another metric matrix in Matlab.
  My program is as follow:</p>
  
  <pre><code>function [V] = adjacency(Z)
  n= size(Z,1);
  V = zeros(n);
  k=1:n;
    for i = 1:n 
      for j = 1:n 
        if Z(i,j)&lt;= max(Z(i,k),Z(j,k)) 
         V(i,j)=1;
         V(j,i)=1;
        else
         V(i,j)=0;
         V(j,i)=0;
        end
      end
    end
  end
  </code></pre>
  
  <p>I don't know how to make the condition that <code>k</code> must be different to <code>i</code> and different to <code>j</code>.</p>