Release 11 New Features |
Upgrading From MATLAB 5.2 to MATLAB 5.3
This section describes differences between Release 11 and Release 10 that may require code changes to your Release 10 code.Language Issues
pcode
Prior to MATLAB 5.3, by defaultpcode
put all its .p
files, including methods and private functions, in the current directory.
That approach resulted in losing the scope directories (private and class directories) for the function and had the potential to have a method from one directory overwrite the method from another directory.
In MATLAB 5.3, by default pcode
puts its .p
files for methods and functions in a corresponding class or private directory (created in the current directory if those directories don't already exist).
If you have any pre-5.3 code that relies on the .p
file being in the current directory, and you generate new P-code for the method, the .p
file will not be where the pre-5.3 code expected it.
Date Functions Need pivotyear Parameter
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. Whether you update your applications that use these date functions depends on the nature of your data and the timeframe when you plan to use the application:
Sparse scalar Expansion
A(:,:) = scalar
was incorrectly producing the result A = scalar
when it should have been changing all the elements of A
to the scalar value (which is what A(1:end,1:end) = scalar
does).
getfield Must Use a 1-by-1 Structure
In MATLAB 5.3, thegetfield
function produces an error message if you use other than a 1-by-1 structure. In MATLAB 5.2, the commands
a(1).b = 1; a(2).b = 3; a(2).b.c = 4; a(1).b.c = 2; d = [getfield([a.b], 'c')];successfully returned the two element vector
d = 2 4but in MATLAB 5.3, the same code would lead to
getfield
returning an error message.
Syntax Change for dlmread
Thedlmread
syntax has changed. You should no longer use the range
argument together with the row and column offsets as you could in previous versions of MATLAB (the row and column offsets actually were not used in pre-5.3 MATLAB, if you specified a range
argument). Using this calling sequence now produces a warning message:
M = dlmread(filename,delimiter,row_offset,column_offset,range)
To use the range
argument, use this new calling sequence:
M = dlmread (filename,delimiter,range)
Behavior of linspace and logspace Now the Same as with MATLAB 5.1
In MATLAB 5.3,linspace
and logspace
now handle NAN
s, Inf
s, and complex vectors in the same manner as they did for MATLAB 5.1 and earlier versions. This eliminates an inconsistency in how linspace
and logspace
handled NAN
s, Inf
s, and complex vectors in MATLAB 5.2, as compared to previous MATLAB releases.
Name Changes
These MATLAB functions have new names and calling sequences to support new functionality.Old Function Name |
New Function Name |
fmin |
fminbnd |
fmins |
fminsearch |
nnls |
lsgnonneg |
Method Search Order Changed
MATLAB now calls converter methods on the path before calling a constructor. Prior to 5.3, MATLAB called constructors before calling methods on the path. One visible effect of this is that in the case where@double/ss.m @ss/ss.mexist, MATLAB calls
@double/ss.m
instead of @ss/ss.m
(i.e., the previously shadowed converter functions become visible).
Change to Subscripting for Objects
In MATLAB 5.3, subscripting syntax is dispatched differently from how it was dispatched in previous releases. Within a method, the syntaxesa(i), a(i,j), etc. a{i}, a{i,j}, etc. a(i).name, a.name, a(i.j).name, etc.now use the built-in
subsref
or subsasgn
method if the type of a
doesn't match the class directory and no overloaded subsref
is defined for the object a
. This change only affects child objects within parent methods.
Prior to 5.3, use of the subsref
or subsasgn
syntax called the parent's subsref
method recursively for a child object. Now the syntax uses the built-in method.
For example, for the following
@parent/get.m function b = get(a,i) b = a(i); @parent/subsref.m function r = subsref(a,s) r = a(1).dat;when no
subsref
existed for @child
c = child(5); get(c,1)used to call the parent's
subsref
method inside @parent/get.m
. MATLAB now uses the built-in method.
Within parent methods where you want the parent's subsref
to be used, call the parent's subsref
directly (using the function syntax).
Use clear classes to Clear the Class Definition Table
To clear the class definition table so that MATLAB picks up changes in an object's field definition, useclear classesIn previous releases, using
clear allwould often clear the class definition table, but not always in the proper manner. Replace
clear all
with clear classes
when you want to clear the class definition table safely.
Changes to legend
MATLAB 5.3 enhanceslegend
to: