MATLAB Release Notes |
Mathematics Upgrade Issues
The issues involved in upgrading from MATLAB 6.5 to MATLAB 7.0, in terms of mathematics features, are discussed in the following sections:
Integer Data Type Functions Now Round Instead of Truncate
The following integer data functions now round noninteger inputs instead of truncating:
in MATLAB 7.0. In previous releases, the same command returned 3
. If you have code that contains these functions, it might return different results in Version 7.0 than in previous releases, in particular, results that differ by 1 after converting floating-point inputs to an integer data type.
You can turn the following warning on to help diagnose these differences:
See New Warnings for Integer Arithmetic for more information about this and other new warning messages.
max and min Now Have Restrictions on Inputs of Different Data Types
In MATLAB 7.0, the functions max
and min
now have the following restrictions on inputs of different data types:
double
.
single
, all other inputs must have type double
or single
.
Other combinations of inputs now return an error message. In previous releases, inputs to max
or min
could have any combination of data types.
For the allowed mixed-type combinations listed above, max
and min
now return results of a different data type than in previous releases.
double
, the result now has the same integer data type. In previous releases, the result had type double
.
single
, while another has type double
, the result now has type single
. In previous releases, the result had type double
.
You can turn on the following warning messages to diagnose any issues that might result from this change in behavior:
warning on MATLAB:max:mixedIntegersScalarDoubleInputs
warning on MATLAB:max:mixedSingleDoubleInputs
warning on MATLAB:min:mixedIntegersScalarDoubleInputs
warning on MATLAB:min:mixedSingleDoubleInputs
Changes to Behavior of Concatenation
When you perform concatenation ([a, b]
, [a;b]
, and cat(a,b,dim)
) on mixed integer and other numeric or logical inputs, the left-most integer type among the inputs is the type of the result. As a result, the other inputs might lose values when they are converted to the integer data type. In Version 7.0, MATLAB now returns a warning when you concatenate these mixed data types.
[int8(100) uint8(200)] Warning: Concatenation with dominant (left-most) integer class may overflow other operands on conversion to return class. (Type "warning off MATLAB:concatenation:integerInteraction" to suppress this warning.) ans = 100 127 class(ans) ans = int8
Concatenating an input of any nondouble numeric data type (single
and integer data type) with type char
now returns a result of type char
. In previous releases, the same operation returned a result of the same type as the numeric data type.
Changes to the Behavior of Sum
In Version 7.0, sum
applied to a vector of type single
performs single
accumulation and returns a result of type single
. In previous releases, sum
performed this operation in double
accumulation. To restore the previous behavior, call sum
with the syntax
See New Class Inputs for sum for more information on this new syntax.
FFT Functions Applied to Integer Data Types are Becoming Obsolete
In previous releases, the following fast Fourier transform (FFT) and related functions cast integer inputs of type uint8
and uint16
to double
, used the double
algorithm, and returned a double
result:
In Version 7.0, these operations return warning messages that recommend convert the inputs to double before applying the function, for example, by fft(double(x))
.
New Warnings for Complex Inputs to atan2, log2, and pow2
The following functions now return a warning for inputs that are not real numbers:
New Names for Demos expm1, expm2, and expm3
The demos expm1
, expm2
, and expm3
have been renamed expmdemo1
, expmdemo2
, and expmdemo3
, to avoid a name conflict with the new function expm1
.
Matrix, Trigonometric, and Other Math Functions No Longer Accept Inputs of Type char
Matrix functions, such as chol
, lu
, and svd
, and trigonometric functions, such as sin
and cos
, no longer accept inputs of type char
. In previous releases, these functions simply converted char
inputs to double before performing operations on them. To restore the previous behavior of these functions, create an M-file that converts its input to double before applying the function. For example, to restore the behavior of sin,
work
directory.
sin.m
in the directory @char
.
Colon Operator on char Now Returns a char
Applying the colon
operator to inputs of type char
now returns a result of type char
. For example,
In previous releases, the same operation returned a result of type double
.
Obsolete Functions
The functions listed in the left column of the following table are obsolete and will be removed from a future version of MATLAB. Use the replacement functions listed in the right column instead.
Obsolete Function |
Replacement Function |
---|---|
colmmd |
colamd |
quad8 |
quadl |
symmmd |
symamd |
The following obsolete functions are no longer included in MATLAB:
Desktop Tools and Development Environment Upgrade Issues | Programming Upgrade Issues |
© 1994-2005 The MathWorks, Inc.