MATLAB Release Notes |
Programming Upgrade Issues
The issues involved in upgrading from MATLAB 7.0 to MATLAB 7.0.1, in terms of programming features, are
ftell Returning Invalid Position in Rare Cases
The ftell
function is likely to return an invalid position when all of the following are true. This is due to the way in which the Microsoft Windows C library currently handles its ftell
and fgetpos
commands:
dlmwrite
and csvwrite
.)
fopen
function with mode set to 'rt'
.
ftell
command is directly preceded by an fgets
command.
Note that this does not affect the ability to accurately read from and write to this type of file from MATLAB.
Using the | Operator in regexp Expressions
Be careful about using the logical OR (|
) operator within square brackets (e.g., [A|B]
) in regular expressions in MATLAB. The recommended way to match "the letter A or the letter B" in a MATLAB regexp
expression is to use '[AB]'
. If you have used '[A|B]'
for this purpose in earlier versions of MATLAB, you may get unexpected results when you run your code in version 7.0.
MATLAB versions 6.0 and 6.5 treat |
as an ordinary character when it is used between square brackets. For example, these versions interpret the expression '[A|B]'
as "match 'A'
, or match '|'
, or match 'B'
." MATLAB 7.0 correctly gives precedence to the logical OR functionality of the |
operator. Because of this change, MATLAB now interprets '[A|B]'
as "match '[A'
, or match 'B]'
."
You can avoid the effects of this bug fix altogether by using the recommended syntax '[AB]'
for this type of operation. This syntax returns the correct results in all MATLAB versions.
The following example attempts to find the word Jill or Bill in the string 'My name is Bill'. The syntax used in the expression is incorrect, but regexp
in MATLAB 6.5 finds a match anyway because of the software bug. This syntax does not work in version 7.0 or 7.0.1 because MATLAB now interprets the expression as the logical OR of the two statements, '[J'
and 'B]ill'
:
- MATLAB 6.5 - - MATLAB 7.0.1 - str = 'My name is Bill'; str = 'My name is Bill'; expr = '[J|B]ill'; expr = '[J|B]ill'; [s e] = regexp(str, expr); [s e] = regexp(str, expr); str(s:e) str(s:e) ans = ans = Bill Empty string: 1-by-0
Using the recommended syntax returns the correct results in all MATLAB versions:
If you want to use |
in an expression as an ordinary character, precede it with a backslash:
str = 'The | operator performs a logical OR'; expr = 'The [\$ \| \#] operator'; [s e] = regexp(str, expr); str(s:e) ans = The | operator
Multiple Declarations of Persistent Variables
You can no longer declare a variable as persistent more than once within a function.
Passing Empty Date Strings to datevec
For the purpose of backwards compatibility, invoking the command datevec
('')
now returns an empty vector. This behavior was not intentional in previous versions of MATLAB, and it is subject to change in future releases.
Mathematics Upgrade Issues | External Interface/API Upgrade Issues |
© 1994-2005 The MathWorks, Inc.