Evaluation of binary expression
John W. Eaton
jwe at bevo.che.wisc.edu
Mon Apr 7 14:12:41 CDT 2008
On 7-Apr-2008, Ben Abbott wrote:
| The behavior you've encountered reflects how my matlab works.
|
| >> nargin = 4
|
| nargin =
|
| 4
|
| >> ((nargin >= 5) & ~isempty(M1))
| ??? Undefined function or variable 'M1'.
|
| Thus, in this instance, it appears that Octave works in a manner consistent/compatible with Matlab.
|
| Perhaps the parser might be modified to respect the behavior you'd prefer, but I have no knowledge of that.
See the "Short-circuit & and | operators" item in the FAQ.
In Matlab, & and | only short circuit inside IF or WHILE conditions.
But (as you note) not outside them. That is a "feature" definitely
*not* worth copying. Bad Matlab.
jwe
More information about the Bug-octave
mailing list