Tuesday, June 29, 2010

Bug in MATLAB?: Increment shortcut in a loop (ex. ++i;)

Today, i used an increment shortcut in a  MATLAB simulation loop. Surprisingly i realized that MATLAB accepts the increment shotcut (++variable) without any warning but it does not increase the variable's value in the loop, it remains the same as  the value that was initialized to.
However as an active Octave user in Ubuntu, this usage of the shortcut was just a programming practice for me and it always worked fine. Actually, as far as i understood from the MATLAB Central, these shortcuts are not implemented in MATLAB. But my point is not the absence of implementation, my point is the absence of warning (or error might be in this case) on the usage of the unimplemented increment shortcut.
It can be called as a bug because a permitted shortcut usage does not work properly at least.

Screeshot from Octave:

Screenshot from Matlab:

Labels: , ,