title: Why can't I use short circuit logical operators on vectors in Matlab?
body: <p>FD is an excel file, A is the data from FD column 5. (Each cell of column 5 include 1, 2 or 3)</p>
  
  <p>If the cell in column 5 in FD include 2 or 3, then ...
  else if the cell in column 5 in FD include 1 or 3 then ..
  ...
  elseif all cell in column 5 include 1 only, then ..
  ...</p>
  
  <p>A = FD (:,5);
  C = 3x3 matrix</p>
  
  <pre><code>If A == 2 || A == 3
     Avg = sum(diag(C)./sum(C+eps,2))/2;
  elseif A == 1 || A == 3
     Avg = sum(diag(C)./sum(C+eps,2))/2;
  elseif A == 1 || A == 2
     Avg = sum(diag(C)./sum(C+eps,2))/2;
  elseif A == 1
     Avg = C(1,1)/sum(sum(C));
  elseif A == 2
     Avg = C(2,2)/sum(sum(C));
  elseif A == 3
     Avg = C(3,3)/sum(sum(C));
  else
     Avg = sum(diag(C)./sum(C,2))/3;
  end
  </code></pre>
  
  <p>However, there is error with the above code. ??? Operands to the || and &amp;&amp; operators must be convertible to logical scalar values.</p>
  
  <p>Does anyone can help?</p>