Release 11 New Features |
MATLAB Language Enhancements
Links to Function DescriptionsSupport for Integer Data Types
New Integer Array Classes
Version 5.3 extends the support for integer data types to include several additional array classes that store integer data types. MATLAB 5.3 adds to the existinguint8
class 8-, 16-, and 32-bit signed and unsigned integer array classe; for example, int16
for signed 16-bit integers.
These classes are primarily meant to store integer values. Most operations that manipulate arrays without changing their elements are defined for these data types (examples are reshape, size, the logical and relational operators, subscripted assignment, and subscripted reference). In addition, MATLAB supports the find
function for integer arrays, but the returned array is of class double
. No math operations except for sum are defined for these classes, since such operations are ambiguous on the boundary of the set (for example, they could wrap or truncate there).
sum Function Now Supports All Integer Types
Thesum
function can now be used with all of the integer data types supported by MATLAB. Previously, sum
only worked with uint8
data type. With this release, sum
also supports the int8
, int16
, and int32
data types and the uint16
and uint32
unsigned data types. When the sum
function is used with integer data types, the value returned by sum
is of class double
.
File I/O Enhancements
User-Extensible File Opening Function
The newopen
function is a user-extensible function that provides an interface to file open operations. Default behavior is provided for these standard MATLAB file types: Handle Graphics figure files, M-files, model files, and P-files. You can extend the interface to include other file types and to override the default behavior for the standard files.
Reading Data From a Uniformly Formatted File
The newtextread
function provides easy reading of data from a uniformly formatted file, such as a comma- or tab-delimitered file, into MATLAB variables. The formatted file can contain both numbers and strings. The data is converted using the types and delimiters you specify.
Enhancements to dlmread
Thedlmread
function was enhanced to significantly improve function performance.
Also, to use the range
argument, use this new calling sequence:
M = dlmread (filename,delimiter,range)
Saving MATLAB Figures or Models
The newsaveas
function saves a MATLAB figure or model to a file using the specified file format.
Support for Single Precision Data
MATLAB now supports single precision data, solely as a storage format. Using thefread
and fwrite
functions, you can read input files containing single precision data and write data to files in single precision format. To convert data to single precision format, use the single
function.
Note
String Conversion
The newstr2double
function converts a character string to a double precision value. The character string should contain the ASCII representation of a scalar value (real or complex). Use of str2double
is recommended over the str2num
function.
The new texlabel
function produces the TeX format from a character string.
Constructing Complex Data
The newcomplex
function constructs complex data from real and imaginary parts.
pause Accepts Fractions of Seconds
Thepause
function now accepts a fractional number of seconds as an input argument. This means that when you use the calling sequence pause(
n)
, n
can be any real number. Previously, n
was restricted to integer values.
Enhancements to quit
Thequit
function has been enhanced to run the script finish.m
, if finish.m
exists anywhere on the MATLAB path. finish.m
is a file you create that contains commands you want to run when MATLAB terminates (i.e., you use quit
, exit
, or click on the X button to close the window on the PC).
Two sample files illustrating what you could put in finish.m
are provided in /toolbox/local
:
finishsav.m
- saves the workspace to a MAT-file when MATLAB quits
finishdlg.m
- displays a dialog box allowing you to cancel quitting
finish.m
file by using quit cancel
.
Y2K Support
All versions of The MathWorks, Inc.'s software products have always represented data in 8-byte double-precision floating-point data type form. This ensures that our products will be able to function properly in your environment in the year 2000 and beyond, including leap years, without any adjustments or action required on your part.Date Functions Calling Sequence Change
With MATLAB 5.3, the date functionsdatenum
, datestr
, and datevec
include a new calling sequence that allows a pivot year specification to override the default. For example, here's the new calling sequence for datevec
:
[...] = datevec(t, pivotyear)This new call uses the pivot year instead of the current year minus 50 years. See "Upgrading From MATLAB 5.2 to MATLAB 5.3" in Chapter 4 for details about possible changes you might want to make to existing applications.
Operating on Cell Arrays
The newcellfun
function is a multipurpose function that performs common operations on the elements of cell arrays, including: isreal
, isempty
, islogical
, length
, ndims
, prodofsize
, size
, and isclass
.
Diagonal Concatenation
The newblkdiag
function concatenates input arguments diagonally in a matrix.
Enhancements to Sparse Matrix Operations
The iterative methods that operate on sparse matrices have been enhanced to accept a function as an argument. For example,x = pcg(A,b)solves the system of linear equations
A*x = b
for x
. When A
is not explicitly available as a matrix, you can express A
as an operator that accepts vector input x
and returns the matrix-vector product A*x
. This operator can be the name of an M-file, a string expression, or an inline object.
Here is a simple example.
function y = afun(x) % AFUN(X) returns A*X, where A = diag(7*ones(n,1)) is diagonal. y = 7*x; % y = A*xThis example calls
pcg
using the function afun
in place of the matrix A = diag(7*ones(n,1))
.
x = pcg('afun',b);
Numerical Analysis
Enhancements to Differential Equation Solvers
Mass Matrix Support. In previous versions of the ODE suite, only the stiff solvers could handle problems of the form M*y'=F(t,y) with a mass matrix M. Since it is often convenient to solve a problem in this mass matrix form, we extended all of the solvers of the ODE suite to solve problems M*y'=F(t,y) with a mass matrix M that is nonsingular and (usually) sparse. In addition, for all but one solver, the mass matrix M can now be both time- and state-dependent, M(t,y). (As before, theode23s
solver allows only constant M.)
The Mass
property of odeset
has been enhanced to include new possible values; the old values are still available. For examples, see the M-file help for fem1ode
, fem2ode
, or batonode
.
Singular Mass Matrices and Differential-Algebraic Equations.
If the mass matrix is singular, then M*y' = F(t,y) is a differential-algebraic equation (DAE). DAEs have solutions only when y0 is consistent, that is, when there is a vector yp0 such that M(t0)*yp0 = F(t0,y0). The two solvers ode15s
and ode23t
can solve DAEs of index 1 provided that M is not state-dependent and y0 is sufficiently close to being consistent.
If there is a mass matrix, you can use odeset
to set MassSingular
to 'yes
', 'no
', or 'maybe
'. The default of 'maybe
' causes the solver to test whether the problem is a DAE. If it is, the solver treats y0 as an initial estimate, attempts to compute consistent initial conditions that are close to y0, and proceeds to solve the problem. When solving DAEs, it is advantageous to formulate the problem so that M is diagonal (a semi-explicit DAE). For examples, see the M-file help for hb1dae
or amp1dae
.
Changes to Function Functions
These MATLAB function functions have new names and calling sequences to support new functionality.Old Function Name |
New Function Name |
fmin |
fminbnd |
fmins |
fminsearch |
Changes to Least Squares Equation Solver
The name of thennls
(nonnegative least squares) function was changed to lsqnonneg
, and its calling sequences have changed as well. These changes have been made to support new functionality.
As noted above, if you have older M-files that use the old names and calling sequences, these calls will generally continue to work.
New Mechanism for Setting Optimization Parameters
MATLAB now has a new mechanism for setting parameters used by the optimization functions. Theoptions
argument for these functions now takes a structure containing the parameters to set, rather than a vector. This structure is created and modified by a new function, optimset
. The new optimget
function extracts the value of a parameter from an options
structure.
This change affects the new optimization functions only (fminbnd
, fminsearch
, and lsqnonneg
). The older functions (fmin
, fmins
, and nnls
) still use the vector returned by the foptions
function.
Note that not all of the parameters set with optimset
apply to every function. Many of the parameters apply only to functions in the Optimization Toolbox.
Changes to cholinc Function
In thecholinc
function's handling of the Cholesky-Infinity factorization, the input matrix is assumed to be positive semi-definite, so negative pivots are treated as if they were 0. Because of this change, the functional form that includes a second output argument p
(shown below) is obsolete:
[R,p] = cholinc(X,'inf')
Programming Enhancements
New evalc Function
The newevalc
function is an extension of eval
. Calling evalc
executes a MATLAB expression and captures any output that would be written to the MATLAB command window in a character array output argument.
New symvar Function
The newsymvar
function searches a MATLAB expression for symbolic variables and returns the names of the variables in a cell array of strings. The identifiers i
, j
, pi
, and other MATLAB constants and function names are ignored.
Enhancements to inline
Theinline
function was improved to better recognize symbolic variable names in a function expression. In addition, multiple variable names are now located.
Enhancements to MATLAB Object-Oriented Programming
Several functions have been added or enhanced to provide additional support for MATLAB object-oriented programming. Loading and Saving Objects. The newloadobj
function is an overloadable function called by the load
command when reading objects from a MAT file into the MATLAB workspace. To define load
behavior for user objects, create a loadobj
function in the associated class directory.
The new saveobj
function is an overloadable function called by the save
command when writing objects from the MATLAB workspace to a MAT file. To define save
behavior for user objects, create a saveobj
function in the associated class directory.
Enhancements to end Statement.
You can overload the end
statement for indexing a user object. To do this, write a method end.m
in the class directory. The end
method must have the following calling sequence
end(myobj,K,N)
where myobj
is the object, K
is the index for which you are using the end
syntax, and N
is the number of indices in the indexing expression.
Use clear classes to Clear the Class Definition Table.
To clear the class definition table, use
This is useful when, during a MATLAB session, you change the way a class is defined. You should no longer useclear
classes
clear allto clear the class definition table.
Application Program Interface (API) Enhancements
ActiveX Support Enhanced
The ActiveX support enhancements for MATLAB 5.3 includeget
to return a list of properties and send
to get a list of all events for an interface
MATLAB 5.0 Data Types Supported in the MATLAB 5.3 API Engine
All MATLAB 5.3 data types, including those introduced in MATLAB 5.0 (cell arrays, multidimensional arrays, and structures) are now supported in the MATLAB 5.3 API Engine.Exploratory MATLAB Java Interface
Intended as a Prototype for Soliciting Your Feedback
Release 11 includes an exploratory MATLAB Java interface. Based on your feedback and additional development and testing efforts, this MATLAB Java interface may be refined and expanded in future releases. Caution Do not use this exploratory version of the MATLAB Java interface for production-level code. This interface will almost certainly change in future releases, and The MathWorks does not commit to ensuring that code written using this exploratory version of the interface will work with future versions of the interface or MATLAB.What You Can Do with the MATLAB Java Interface
You can use the MATLAB Java interface to:How to Start the MATLAB Java Interface
To start the MATLAB Java interface, at the command line type:java on