User`s guide

2 MATLAB 6.1 Release Notes
2-8
Programming and Data Types Features
Partial Evaluation of Expressions
Within the context of an if or while expression, MATLAB does not necessarily
evaluate all parts of a logical expression. In some cases, it is possible, and often
advantageous, to determine whether an expression is true or false through only
partial evaluation. This is sometimes referred to as short-circuiting.
For example, if
A equals zero in statement 1 below, then the expression
evaluates to
false, regardless of the value of B. In this case, there is no need
to evaluate
B and MATLAB does not do so. In statement 2, if A is nonzero, then
the expression is
true, regardless of B. Again, MATLAB does not evaluate the
latter part of the expression.
1) if (A & B) 2) if (A | B)
You can use this property to your advantage to cause MATLAB to evaluate a
part of an expression only if a preceding part evaluates to the desired state.
Note Partial evaluation of expressions in if and while was also available in
MATLAB 6.0, but was not documented.
New MATLAB Search String Function
strfind is a new character array function in MATLAB. It searches for all
occurrences of a string pattern within another, longer string. Placement of the
two string arguments in the argument list requires that you be specific about
which string is the character pattern to search for and which is the string in
which to search. This allows you more control over how the search is performed
compared with the MATLAB
findstr function, particularly when executing
searches within a loop.