Wed 20 Jul 2011 10:27:27 AM UTC, original submission:
nargchk behaviour differs between MATLAB and octave in cases like the following:
s = nargchk(1,5,4,'struct')
MATLAB returns
s =
0x1 struct array with fields:
message
identifier
Octave returns
s =
scalar structure containing the fields:
octave:5> whos s
Variables in the current scope:
Attr Name Size Bytes Class
==== ==== ==== ===== =====
s 1x1 0 struct
I.e. MATLAB returns an empty struct with two fields, while Octave returns a 1-element struct with no fields. MATLAB has documented its nargchk behaviour as follows:
--- cited from MATLAB help
MSGSTRUCT = NARGCHK(LOW,HIGH,N,'struct') returns an appropriate message structure if N is not between LOW and HIGH. If N is in the specified range, the message structure is empty. The message structure has at a minimum two fields, 'message' and 'identifier'.
---
MATLAB code that relies on this behaviour will fail on Octave if N is in the specified range. This may be related to bug #33428.
|