Short Circuit

Short Circuit includes && (short circuit and) and || (short circuit or). They are both logical operators.

Depending on whether A is square, under determined, or over determined, the way to solve this solution is different. When A is square, x = A*inv(B) is used to solve the solution. If A is over determined, the least squares solution is produced. If A is underdetermined, then a least squares solution with the maximum number of zeros is produced.

Table 1.
&& Scalar Row Vector Column Vector Matrix
Scalar If any conditions going from left to right are false, no more comparisons are made. Returns a true or false value (1 or 0) based on whether both expressions are true. Ex: b~=0 && b/a > 3      
Row Vector        
Column Vector        
Matrix        
Table 2.
|| Scalar Row Vector Column Vector Matrix
Scalar Returns a true or false value (1 or 0) based on whether one or both expressions are true. Returns a true or false value (1 or 0) based on whether one or both expressions are true. The first expression must be true scalar or an error will occur. This comparison will also only work if there is only one Or statement being used. Returns a true or false value (1 or 0) based on whether one or both expressions are true. The first expression must be a true scalar or an error will occur. This comparison will also only work if there is only one Or statement being used. Returns a true or false value (1 or 0) based on whether one or both expressions are true. The first expression must be a true scalar or an error will occur. This comparison will also only work if there is only one Or statement being used.
Row Vector        
Column Vector        
Matrix        

&& ( short circuit and): If any of the conditions working from left to right are false, a false value is returned and no more comparisons are made. This can be a convenient way to prevent errors.

Examples

a=4
if (exist('b') && (b~=0))
      a=b
end

If b was not defined, then checking the value of b would generate an error.

|| (short circuit or): Similarly, if any of the conditions working from left to right are true, a true value is returned and no more comparisons are made.