Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# MATLAB Release Notes

## R2013b

New Features, Bug Fixes, Compatibility Considerations

### Language and Programming

#### table data container for managing, sorting, and filtering mixed-type tabular data

table is a new data type to collect mixed-type data and metadata properties, such as variable names, row names, descriptions, and variable units, in a single container. Tables are suitable for column-oriented or tabular data that is often stored as columns in a text file or in a spreadsheet. For example, you can use a table to store experimental data, with rows representing different observations and columns representing different measured variables.

Tables consist of rows and column-oriented variables. Each variable (column) in a table can have a different data type and a different size with the restriction that each variable must have the same number of rows. For example,

```T =

Gender    Age    Smoker     BloodPressure
------    ---    ------    ---------------
Smith       'M'       38     true      124          93
Johnson     'M'       43     false     109          77
Williams    'F'       38     false     125          83
Jones       'F'       40     false     117          75
Brown       'F'       49     false     122          80```

#### categorical array for ordered and unordered categorical data

categorical is a data type to store data with values from a finite set of discrete categories. A categorical array provides efficient storage and convenient manipulation of nonnumeric data, while also maintaining meaningful names for the values. Ordinal categorical arrays are a type of categorical array whose categories have a mathematical order. For example,

```myCategorical =

medium      large      small      small      medium ```
`categories(myCategorical)`
```ans =

'small'
'medium'
'large'```

You can use categorical arrays in a table to select groups of rows. For more information, see Categorical Arrays.

#### timeit function for robust time estimates of function execution

The timeit function measures the time required to run a function. It provides a more robustly computed time estimate than tic/toc.

#### localfunctions function for getting handles to all local functions in a file

The localfunctions function returns a cell array of function handles to all local functions in the current file.

#### Functions for writing, executing, and verifying tests using the matlab.unittest testing framework without creating custom classes

As an alternative to writing object-oriented tests, the MATLAB® xUnit-style testing framework now provides function-based writing, execution, and verification of tests. For more information, see Unit Testing Framework. For an example of function–based test writing, see Write Simple Test Case Using Functions.

#### matlab.mixin.CustomDisplay utility class to write custom display methods

Use the matlab.mixin.CustomDisplay class to customize object display for your MATLAB class.

#### flip function, a faster and more memory efficient alternative to flipdim for flipping arrays and vectors

The flip function provides a faster and more memory efficient alternative to flipdim for flipping arrays and vectors.

#### Partial name matching in inputParser

The inputParser now includes the PartialMatching property, which allows partial matching of parameter names. This property is true by default. For more information, see the inputParser reference page.

#### Compatibility Considerations

Parsing schemes requiring exact parameter name matching should set the inputParser PartialMatching property to false.

#### Additional validateattributes options for checking array values

The validateattributes function now checks the following additional attributes of numeric or logical input arrays.

Attribute

Description

'decreasing'

Each column element is less than the previous element and no element is NaN.

'increasing'

Each column element is greater than the previous element and no element is NaN.

'nondecreasing'

Each column element is greater than or equal to the previous element and no element is NaN.

'nonincreasing'

Each column element is less than or equal to the previous element and no element is NaN.

For more information, see the validateattributes reference page.

#### Conversion changes of out-of-range numbers passed to Java methods that take integers

MATLAB R2013b changes the way it converts out-of-range values for the following Java® integer types:

• Signed 32-bit integer (Java int, short or byte parameters)

• Signed 64-bit integer (Java long parameters)

For a description of the conversion, see Converting Numbers to Integer Arguments.

#### Compatibility Considerations

If your MATLAB code can pass out-of-range values to Java methods with integer type arguments, the results might change. For example, the following value, val, is out-of-range for the argument to java.lang.Integer.

```val = uint32(2^31);
java.lang.Integer(uint32(val))```

In previous versions of MATLAB, the result is:

```ans =

-2147483648```

As of MATLAB R2013b, the result is:

```ans =

-1```

#### Additional properties for mex.getCompilerConfigurations function

The mex.getCompilerConfigurations function returns the following new properties:

• ShortName — Character string used to identify options file for the compiler

• MexOpt — Name and full path to options file

• Priority — The priority of this compiler

#### Changes to compiler support for building MEX-files

MATLAB no longer supports the following compilers on Microsoft® Windows® platforms:

• Intel® C++ Version 11

• Intel Visual Fortran Version 11

• Open Watcom C/C++

#### Compatibility Considerations

To ensure continued support for building your MEX-files, consider upgrading to another supported compiler. For an up-to-date list of supported compilers, see the Supported and Compatible Compilers Web page.

#### Changes to time alignment for time series objects

The IsTimeFirst property for time series objects is now read only. The property value is false for 3-D and higher dimensional data. Otherwise, the value is true.

• true — The first dimension of the data array is aligned with the time vector. For example, ts = timeseries(rand(3,3),1:3);

• false — The last dimension of the data array is aligned with the time vector. For example: ts = timeseries(rand(3,4,5),1:5);

Consequently, the alignment of the Time property with the first or last data dimension of the Data property is based on the number of dimensions of the data. When the data contains three or more dimensions, the length of the Time property matches the size of the last data dimension. Otherwise, the length of the Time property matches the size of the first data dimension.

#### Compatibility Considerations

You receive an error when creating a time series object with 3-D or higher dimensional data and with time alignment along the first dimension.

To preserve the property value of true for IsTimeFirst with 3-D or higher dimensional data, reshape the data array to two dimensions, such that the last data dimension and the time dimension are compatible. For example, replace timeseries(ones(10,4,2),1:10) with timeseries(ones(10,8),1:10).

To preserve the number of dimensions of a 3-D or higher dimensional data array, use permute to reorder the data array, such that the size of the last data dimension aligns with the time vector.

Furthermore, you receive a warning when loading a time series object from a prior release with 3-D or higher dimensional data and with time alignment along the first dimension. In this case, MATLAB preserves the time alignment with the first dimension and reshapes the data to 2-D.

#### New fixture and plugin features for matlab.unittest testing framework

The matlab.unittest testing framework now provides four customized fixtures to ease the creation of setup and teardown code. You can use these fixtures to change the current working folder, add a folder to the MATLAB path, suppress the display of warnings, and create a temporary folder. For more information, see matlab.unittest.fixtures.

To share these fixtures across test classes, use the new SharedTestFixtures class attribute of TestCase. The getSharedTestFixtures method of TestCase provides access to the shared fixtures. You also can use fixtures within a test function by calling the applyFixture method of TestCase.

To pause execution of a test and enter debug mode upon a failure or uncaught error, you can add the new plugin, StopOnFailuresPlugin to the test runner. For more information, see matlab.unittest.plugins.

#### Conversion of error and warning message identifiers

For R2013b, error and warning message identifiers have changed in MATLAB.

#### Compatibility Considerations

If you have scripts or functions that use message identifiers that changed, you must update the code to use the new identifiers. Typically, message identifiers are used to turn off specific warning messages, or in code that uses a try/catch statement and performs an action based on a specific error identifier.

For example, the MATLAB:InputParser:MustBeChar identifier has changed to display either MATLAB:InputParser:MustBeChar or MATLAB:InputParser:ParamMustBeChar. If your code checks for MATLAB:InputParser:MustBeChar, you might need to update it to check for MATLAB:InputParser:ParamMustBeChar instead. For a mapping of the new identifiers to the original identifiers, see Technical Support solution 1-ERAFNC.

#### Functionality being removed or changed

Functionality

What Happens When You Use This Functionality?

Compatibility Considerations

addParamValue method of inputParser class

Still Runs

Replace all instances of addParamValue with addParameter.

tstool

Warns

Replace all instances of tstool with timeseries, tscollection, openvar, or plot.

To create a time series object, use timeseries.

To create a time series collection with one or more timeseries objects, use tscollection.

To open a time series object or collection in the Variables editor, use openvar.

To plot a time series object, use plot.

Time series object with 3-D or higher dimensional data and time aligned with the first dimension

Errors

Time series object with 2-D data and time aligned with the first dimension or a time series object with 3-D or higher dimensional data and time aligned with the last dimension

For more information about updating your code and assessing the impact of this change, see Changes to time alignment for time series objects.

cat(0,A,B)

Errors

cat(1,A,B)

In previous releases, the cat function silently changed dim=0 to dim=1. Now, cat returns an error when dim=0. Replace all instances of cat(0,A,B) to cat(1,A,B).

cat(z,A,B), where z is a complex number

Errors

cat(real(z),A,B)

In previous releases, the cat function silently used the real part of dim. Now, cat returns an error when dim is complex. Replace all instances of cat(z,A,B) to cat(real(z),A,B).

mexIsGlobal in the C/C++ and Fortran MEX API Library

Still Runs

Replace all instances of mexIsGlobal with mxIsFromGlobalWS in MEX-files.

### Desktop

#### Improved viewing and editing of one-dimensional structure arrays in the Variables editor

One-dimensional (n-by-1 or 1-by-n) structure arrays in the Variables editor now display field contents arranged in columns, in a single pane. You can reorder fields by dragging a column.

The new display allows you to work with one-dimensional structure arrays as you would with other workspace variables. For example, you can edit field values in-place, create new variables from a selection, and plot selected data using the options on the Plots tab.

For more information about editing structure arrays using the Variables editor, see Edit Table and Structure Array Data Interactively

#### Improved management of a large number of open files, figures, and documentation pages

Files, docked figures, and documents each display in separate tabs that you can rearrange. For example, each file displays on a tab in the MATLAB Editor.

A drop-down list provides quick access to tabs that do not fit in the window when a large number of files, figures, or documents are open. When viewing multiple documents in a tiled layout, you can drag tabs to create new tiles or move documents between existing tiles. The tabs replace the document bar that was shared across tiles in earlier versions of MATLAB.

#### Expand all option for opening collapsed sections in documentation pages for printing and in-page searching

Some documentation pages include sections that are collapsed by default, such as input argument descriptions or examples. In-page searches do not find terms in those sections unless you first expand the sections. In R2013b, you can easily expand all sections on a page by clicking expand all in page, which is located at the top right of pages with collapsed sections. Then, you can search for terms anywhere on the page, or print the page in its entirety.

#### Java integration updated to version 7, providing access to new Java features and bug fixes

As of R2013b, support for the Oracle® Java Runtime Environment (JRE™) has been updated to Java 7 Update 11 on all platforms.

#### Bundling of Java on Mac, removing dependency on Apple supplied Java runtime

The Mac version of MATLAB is no longer dependent on the Apple-provided JRE.

#### Enhanced print options on Mac operating systems

On Macintosh systems, the Print dialog box now provides more print options. You can access all print options provided by the native Macintosh print dialog. For example, you can select the number of pages to print per sheet, add a border or watermark, and print to a PDF file. To access the Print options, press Command+P from the Command Window or the MATLAB Editor.

#### Compatibility Considerations

Page Setup options, such as paper size and orientation, are no longer accessible from the Print dialog box. To access Page Setup options, select the Editor tab. In the File section, click Print and then select Page Setup. Alternatively, from the Command Window or Editor, use the keyboard shortcut, Command+Shift+P. The Page Setup dialog box opens. In the Settings menu, ensure that Page Attributes is selected.

To access the options previously available from the Page Setup dialog box (such as Layout, Header, and Fonts options), select MATLAB in the Settings menu.

#### Option for following documentation links to uninstalled products

By default, the Help browser displays only the documentation associated with your installed products. In previous releases, if you used this default and clicked a link to documentation in an uninstalled product, the Help system displayed a "Page Not Found" error. Now, the Help system asks if you want to view the page from the MathWorks Web site. If so, the page opens in the Help browser.

For information on changing the default settings, see Help Preferences.

#### Preferences dialog box improvements for easier navigation

Options in the left pane of the Preferences dialog box are arranged by product, and alphabetized within each product for simpler navigation. This change does not affect code that calls preferences. To access the Preferences dialog box, click Preferences on the Home tab.

#### Auto-adjust capability in Variables editor

You now can auto-adjust the column width for elements of numeric, cell, structure, and table arrays in the Variables editor. Point to the border to the right of a column heading, until a double-headed arrow appears. Then, double-click to auto-adjust the width of that column.

#### MATLAB support added to Windows 7 Default Programs control panel

You can manage MATLAB file associations on Microsoft Windows 7 systems using the Set your default programs option in the Default Programs control panel.

MATLAB no longer supports selective installation of individual file associations.

#### Japanese localization available on Mac platforms

If your Mac Language setting is Japanese, then MATLAB, Simulink®, and other localized MathWorks products now have a Japanese user interface and documentation.

### Mathematics

#### Functionality being removed or changed

FunctionalityWhat Happens When You Use This FunctionalityUse This InsteadCompatibility Considerations

interp1(X,Y,Xq,[],...) where [] specifies the default interpolation method

Still Runs

interp1(X,Y,Xq,'linear',...)

Replace all instances of interp1(X,Y,Xq,[],...) with interp1(X,Y,Xq,'linear',...).

Passing mixed-orientation vectors to interp2:

Vq = interp2(x,y,V,xq,yq)

Specifically, if one or both of the following are true:

• One of x and y is a row vector and the other is a column vector.

• One of xq and yq is a row vector and the other is a column vector.

Still Runs

Construct the full grid with meshgrid first. Alternatively, use griddedInterpolant if you have a large data set.

Modify all instances that pass mixed-orientation vectors to interp2. You can modify your code in one of two ways:

• Call meshgrid to construct the full grid first.
[X,Y] = meshgrid(x,y);
[Xq,Yq] = meshgrid(xq,yq);
Vq = interp2(X,Y,V,Xq,Yq);

• Pass the vectors to griddedInterpolant inside a cell array.
F = griddedInterpolant({x,y},V.');
Vq = (F({xq,yq})).'

Passing mixed-orientation vectors to interp3:

interp3(x,y,z,V,xq,yq,zq) Specifically, if one or both of the following are true:

• x, y, and z are a combination of row and column vectors.

• xq, yq, and zq are a combination of row and column vectors.

Still Runs

Construct the full grid with meshgrid first. Alternatively, use griddedInterpolant if you have a large data set.

Modify all instances that pass mixed-orientation vectors to interp3. You can modify your code in one of two ways:

• Call meshgrid to construct the full grid first.
[X,Y,Z] = meshgrid(x,y,z);
[Xq,Yq,Zq] = meshgrid(xq,yq,zq);
Vq = interp3(X,Y,Z,V,Xq,Yq,Zq);

• Pass the vectors to griddedInterpolant inside a cell array.
V = permute(V,[2 1 3]);
F = griddedInterpolant({x,y,z},V);
Vq = F({xq,yq,zq});
Vq = permute(Vq,[2 1 3]);

Passing mixed-orientation vectors to interpn:

interpn(x1,x2,...,xn,V,x1q,x2q,...,xnq)

Specifically, if one or both of the following are true:

• x1,x2,...,xn are a combination of row and column vectors.

• x1q,x2q,...,xnq are a combination of row and column vectors.

Still Runs

Construct the full grid with ndgrid first. Alternatively, use griddedInterpolant if you have a large data set.

Modify all instances that pass mixed-orientation vectors to interpn. You can modify your code in one of two ways:

• Call ndgrid to construct the full grid first.
[X1,X2,...,Xn]= ndgrid(x1,x2,...,xn);
[X1q,X2q,...,Xnq]= ndgrid(x1q,x2q,...,xnq);
Vq= interpn(X1,X2,...,Xn, V, X1q,X2q,...,Xnq);

• Pass the vectors to griddedInterpolant inside a cell array.
F= griddedInterpolant({x1, x2,...,xn}, V);
Vq= F({x1q, x2q,...,xnq});

interp1(...,'cubic')

Warns

interp1(...,'pchip')

Replace all instances of interp1(...,'cubic') with interp1(...,'pchip')

Passing the 'pp' flag to interp1. For example:

pp = interp1(x,v,'linear','pp');
vq = ppval(pp,xq);

WarnsUse griddedInterpolant to create an interpolating function that is efficient to evaluate in a repeated manner.

Replace all instances of interp1(...,'pp') with griddedInterpolant. For example:

F = griddedInterpolant(x,v,'linear');
vq = F(xq);

bitshift(A,k,N)Warns

bitshift(A,k,assumedtype)

Replace all instances of bitshift(A,k,N) with bitshift(A,k,assumedtype).
bitcmp(A,N)Warns

bitcmp(A,assumedtype)

Replace all instances of bitcmp(A,N) with bitcmp(A,assumedtype).
repmat(A,r1,r2), where r1 and r2 are row vectorsWarnsrepmat(A,[r1 r2])Replace all instances of repmat(A,r1,r2) with repmat(A,[r1 r2]).
repmat(A,empt), where empt is an empty arrayWarnsrepmat(A,1)Replace all instances of repmat(A,empt) with repmat(A,1).
repmat(A,empt1,empt2), where empt1 and empt2 are empty arraysWarnsrepmat(A,1)Replace all instances of repmat(A,empt1,empt2) with repmat(A,1).
repmat(A,n,empt), where empt is an empty arrayWarnsrepmat(A,[n 1])Replace all instances of repmat(A,n,empt) with repmat(A,[n 1]).
repmat(A,empt,n), where empt is an empty arrayErrorsrepmat(A,[n 1])Replace all instances of repmat(A,empt,n) with repmat(A,[n 1]).
repmat(A,col), where col is a column vectorErrorsrepmat(A,col.')Replace all instances of repmat(A,col) with repmat(A,col.').
repmat(A,B), where B is a matrixErrorsbvec = B(1:length(B));
repmat(A,bvec)
Replace all instances of repmat(A,B) with the following code:
bvec = B(1:length(B));
repmat(A,bvec).
repmat(A,B,C), where B and C are matricesErrorsBC = [B C];
bcvec = BC(1:length(BC));
repmat(A,bcvec)
Replace all instances of repmat(A,B,C) with the following code:
BC = [B C];
bcvec = BC(1:length(BC));
repmat(A,bcvec).
Noninteger-valued size inputs for zeros, ones, eye, Inf, NaN, true, false, rand, randi, randn, and cellErrorsInteger valued size inputsReplace all instances of noninteger-valued size inputs with integer-valued size inputs for zeros, ones, eye, Inf, NaN, true, false, rand, randi, randn, and cell. You can use floor for this conversion.
mimofrErrorsNot ApplicableRemove all instances of mimofr from your existing code.

### Graphics

#### Mac support for copying figures in vector formats to other applications

MATLAB for Mac now supports copying figures to other applications in a high-resolution PDF format. If the figure contains uicontrols, then MATLAB uses a TIFF format instead.

#### savefig for saving figures to FIG-files

savefig saves one or more figures to a FIG-file.

#### OpenGL workarounds

If MATLAB crashes because of problems with your current version of OpenGL®, then use one of the following workarounds:

• Start MATLAB with the -softwareopengl startup flag to use the software version of OpenGL.

• Execute the opengl neverselect command in your startup.m file to prevent MATLAB from selecting OpenGL as the renderer.

#### Functionality being removed or changed

FunctionalityWhat Happens When You Use This Functionality?Use This InsteadCompatibility Considerations

Numeric specifiers to set legend location

Still runs

Supported string specifiers

Remove all instances of using numeric specifiers to set the legend location

get(0,'CommandWindowSize')

Still Runs

matlab.desktop.commandwindow.size

Replace all instances of get(0,'CommandWindowSize') with matlab.desktop.commandwindow.size. The new command is compatible with MATLAB R2013a and later releases.

printdlg('-setup',fig)WarnsUse the operating system printer management utilities to set up a new printerRemove all instances of using printdlg with the -setup option

### GUI Building

#### Custom icons for MATLAB apps you create

You can now package a custom icon in an app that you create. When selecting an icon, click Use your own icon... .

A second dialog box opens. Click Select icon to browse for a custom icon. The dialog box also displays three icon sizes. MATLAB automatically scales your icon for use in the Install dialog, App gallery, and quick access toolbar. For more information, see Package Apps.

### Performance

#### repmat with numeric, char, and logical types

The performance of the repmat function improves when the input array contains numeric, char, or logical values.

#### Linear algebra functions on computers with new AMD processors

The performance of the linear algebra functions improves on computers with AMD® processors supporting the Intel AVX instruction set.

### Data Import and Export

#### fprintf function prints Unicode characters to the screen

The fprintf function now displays Unicode® characters on the screen. Previously, text was displayed with the user default character encoding, which is dependent on the user locale.

#### Compatibility Considerations

When displaying non-ASCII text on the screen, the fprintf function might return a different output value for the number of displayed bytes, compared to previous versions of MATLAB. This output value is now equal to the number of characters displayed on the screen.

There are no changes to the behavior of fprintf when writing text to a file, or when printing ASCII text to the screen.

#### Changes to default encoding for sendmail function

When calling the sendmail function on systems using a Japanese locale, the default character encoding is now UTF-8. Previously, the default encoding was SJIS.

#### Compatibility Considerations

This change affects only systems that use a Japanese locale. To use the SJIS character encoding, call:

`setpref('Internet','E_mail_Charset','SJIS');`

#### Functionality being removed or changed

FunctionalityWhat Happens When You Use This Functionality?Use This InsteadCompatibility Considerations
hdftoolWarns Read data from HDF files using hdfread or the low-level functions in the matlab.io.hdf4.sd, matlab.io.hdfeos.gd, and matlab.io.hdfeos.sw packages.

## R2013a

New Features, Bug Fixes, Compatibility Considerations

### Desktop

#### Option to add separators between controls on the quick access toolbar

You can now insert and move separators bars on the quick access toolbar. This helps to organize icons into groups. For information on how to customize and organize icons on the quick access toolbar, see Access Frequently Used Features.

#### Additional icon choices, auto-scaled thumbnails, and text-formatting options for customizing descriptions of MATLAB apps

When you package an app by clicking the Package App tab on the Apps tab, MATLAB opens the Package app dialog box. In the Describe your app section of the dialog box, you can:

• Click the app icon , and then select a new icon from the display to represent your app in the Apps gallery.

• Use formatting options when writing the app description.

Options include: bold, italic, monospace, and hyperlinked text; bulleted and numbered lists; images.

In addition, MATLAB automatically scales the screenshot you provide when packaging. This screenshot appears in the tooltip MATLAB displays when hovering over an app icon in the App gallery. The screenshot is scaled to fit a 300 x 300 area and maintains its original aspect ratio.

#### Left-aligned table of contents for navigating in the Help browser and online Documentation Center

The documentation now includes a table of contents that can remain open and that does not overlap the content. View the table of contents by clicking the Contents icon on the left edge of the window.

#### Search term highlighting and content expansion in the Help browser

In the Help browser, search terms now appear highlighted when you view pages linked from the search results. If the search term occurs within a collapsed section on the page, the browser automatically expands the content.

For example, the reference page for the publish function includes the term bmp in collapsed content. When you search the documentation for bmp, and then select the publish reference page, the Help browser expands the relevant section on the page and highlights all occurrences of the term.

To clear highlights, press the Esc key.

#### Context menu items in Help and Web browsers for zooming, page navigation, and saving

Both the Help browser and the MATLAB Web browser now provide easy access to commonly used features in their context menus. Right-click within the browser to see the available options, which include zooming to change the font size, searching within a page, navigating back or forward, or saving the HTML to a file.

 Note:   These context menu items are not available on Macintosh systems.

#### Removal of Handle Graphics support under -nojvm startup option

When you start MATLAB with the -nojvm startup option, Handle Graphics® functionality is not supported. (The -nojvm option is available for UNIX® platforms; see background information on the matlab (UNIX) reference page.)

Some aspects of MATLAB and related products use Handle Graphics in a way that might not be obvious. This includes anything that is based on or works using figures in MATLAB. Here is a summary of the affected features:

• Creating figures and performing plotting tasks, such as using the plot, axes, getframe, and gcf functions.

• Printing figures and using related functions such as print, hgexport, and saveas.

• Creating GUIs in MATLAB using GUI-building functions such as warndlg.

• Using Simulink scopes and printing Simulink models.

If you use the -nojvm startup option and use Handle Graphics functionality, MATLAB produces an error.

#### Compatibility Considerations

To avoid the error, start MATLAB without the -nojvm startup option:

• If you have been using the -nojvm startup option to work in a command line environment or because you do not use the MATLAB desktop, use the -nodesktop startup option instead.

• If you have been using the -nojvm startup option because of memory or performance benefits, look for other ways to gain those improvements when you start MATLAB without the -nojvm option. See topics in Performance and Memory.

• If you want to continue to use the -nojvm startup option, remove the code that is now producing the warnings.

#### -noFigureWindows startup option suppresses figures on Linux and Mac platforms

When you start MATLAB with the -noFigureWindows startup option, MATLAB disables the display of figure windows.

#### No default keyboard shortcut for overwrite mode

There is no longer a default keyboard shortcut for Overwrite mode, and OVR no longer appears at the bottom right corner of the MATLAB status bar. Previously, the Insert key by default toggled between Insert and Overwrite modes in the Command Window and in the MATLAB Editor.

#### Compatibility Considerations

To enable Overwrite mode, assign a keyboard shortcut to this action. On the Home tab, in the Environment section, click Preferences > Keyboard > Shortcuts. Search or scroll to find the action name, Toggle Insert/Overwrite Mode, and assign a keyboard shortcut. Use this shortcut to toggle between Insert and Overwrite modes.

#### Support requests using prerelease versions

If you have Internet access, you can submit a technical support request to MathWorks® from MATLAB by selecting Help > Request Support. Previously, this feature was only available in the final version of each release. Beginning with R2013a, this feature is also available in the prerelease version.

### Language and Programming

#### matlab.unittest package, an xUnit-style testing framework for the MATLAB language that allows writing and running unit tests, and analyzing test results

For information about the matlab.unittest package, see Unit Testing Framework.

#### strsplit and strjoin functions for splitting and joining strings

The strsplit function splits a string into a cell array of strings. The strjoin function joins strings in a cell array into a single string.

#### Additional validateattributes options for checking array size and shape

The validateattributes function now checks the following attributes of input arrays.

Attribute

Description

'3d'

Array with three or fewer dimensions

'ndims', N

N-dimensional array

'square'

Square matrix

'diag'

Diagonal matrix

For more information, see the validateattributes reference page.

#### Help text for enumerations and events

The help and doc commands now display help text that you define for enumerations and events in custom classes. For more information, see Create Help for Classes.

#### Removal of support for .jar documentation files

The Help system no longer extracts documentation from .jar files. All custom documentation must be in uncompressed HTML files.

For more information, see Display Custom Documentation.

#### Changes to Microsoft .NET Framework support

As of R2013a, the MATLAB .NET interface requires the Microsoft .NET Framework Version 4.0 and above. The interface continues to support assemblies built on Framework 2.0 and above.

#### Compatibility Considerations

You must have the .NET Framework Version 4.0 or above installed on your system. If you enter any NET. or System. commands on a machine without Framework 4.0, MATLAB displays a warning. To determine if your system has a supported framework, use the NET.IsNETSupported function.

#### Changes to compiler support for building MEX-files

MATLAB supports these new compilers for building MEX-files.

Microsoft Windows platforms:

• Visual C++® 2012

• Intel C++ XE 2013

• Intel Visual Fortran XE 2013

Mac OS X platforms:

• Apple Xcode 4.2 and higher with Clang

MATLAB no longer supports the following compiler on Mac OS X platforms:

• Xcode with gcc

#### Compatibility Considerations

To ensure continued support for building your MEX-files, consider upgrading to another supported compiler. For an up-to-date list of supported compilers, see the Supported and Compatible Compilers Web page.

#### Changes to subclasses of built-in classes

Subclasses of built-in classes no longer inherit the following methods:

• ones

• zeros

• true

• false

• cast

As a result of this change, you cannot call these methods with an object of a built-in subclass. For example, given a class, mySubclassOfDouble, that derives from double, the following attempt to call cast results in an error:

```a = mySubclassOfDouble(1);   % constructor
b = a.cast('int8');          % ok in R2012b but errors in R2013a
```

However, you can call the corresponding built-in functions with objects of the subclass. Use the function syntax instead of the method dot notation syntax:

```b = cast(a,'int8');
```

#### Compatibility Considerations

Change code that attempts to call these methods to call the built-in function instead. Use function syntax instead of dot notation, as described in the previous section.

#### Conversion of error and warning message identifiers

For R2013a, error and warning message identifiers have changed in MATLAB.

#### Compatibility Considerations

If you have scripts or functions that use message identifiers that changed, you must update the code to use the new identifiers. Typically, message identifiers are used to turn off specific warning messages, or in code that uses a try/catch statement and performs an action based on a specific error identifier.

For example, the MATLAB:addtodate:Nargin identifier has changed to MATLAB:addtodatemx:Nargin. If your code checks for MATLAB:addtodate:Nargin, you must update it to check for MATLAB:addtodatemx:Nargin instead. For a mapping of the new identifiers to the original identifiers, see Technical Support solution 1-ERAFNC.

#### No strict-match requirements for month formats when converting date strings

When reading date strings, the date functions datenum, datevec, and datestr now treat months expressed as full names, three-letter abbreviations, or numbers in date string inputs interchangeably. In previous releases, the commands fail if a date string input does not match the format input. Using the datestr function to write date strings is not affected.

For example, consider the cell array of date strings, where each date string indicates the month in a different format:

```mydates = {'31-October-2012','31-Oct-2012','31-10-2012'};
datevec(mydates,'dd-mm-yyyy')
```
```ans =

2012          10          31           0           0           0
2012          10          31           0           0           0
2012          10          31           0           0           0```

Replacing the date string format input, 'dd-mm-yyyy', with 'dd-mmm-yyyy' or 'dd-mmmm-yyyy' returns the same output. Previously, the command failed, because the first two date strings include a full month name and a month abbreviation, which are not strict matches to the mm month format specified.

#### Compatibility Considerations

The date functions datenum, datevec, and datestr do not error when month formats are inconsistent across multiple date strings in a cell array of strings. When reading a cell array of date strings, you no longer can rely on using a format that includes a field for month name or abbreviation to catch date strings that specify a month number. You should ensure that all date strings in a cell array have the same format to avoid the possibility of confusing day and month numbers. For example,

```mydates = {'11-Oct-2012','11-10-2012'};
datevec(mydates,'dd-mmm-yyyy')
```
```ans =

2012          10          11           0           0           0
2012          10          11           0           0           0```

In R2013a, both dates are silently interpreted as October 11, 2012 although you might have intended '11-10-2012' to be in month-day-year format, representing November 10, 2012.

#### Date functions error on out-of-range quarter values

Valid values for quarter formats are Q1 through Q4 when converting date strings using the datenum or datevec functions. Values outside this range throw an error. Previously, the date functions accepted values outside the range, such as Q5, but returned incorrect results.

#### Compatibility Considerations

To prevent errors when parsing quarter values, remove values outside the valid range (Q1 through Q4) from your code.

#### String representations of large integers using exponential notation

The num2str function converts any large floating-point number that loses precision due to hardware limitations to a string representation that uses exponential notation. Such floating-point numbers are those greater than flintmax. Previously, num2str returned a string representation in decimal notation.

This change in behavior affects only the syntax str = num2str(x). The following example compares the output of num2str in R2013a to R2012b.

R2013aR2012b
`num2str(30e+25)`
```ans =
3e+26
```
`num2str(30e+25)`
```ans =
300000000000000000000000000
```

#### Compatibility Considerations

To obtain a string representation of large integers that uses decimal notation, call int2str(x) instead of num2str(x).

#### Do not use classpath.txt file to modify Java static path

As of R2012b, the file classpath.txt is no longer used to add custom paths to the static Java class path. A new MathWorks product installation rewrites the static class path (found in the classpath.txt file).

#### Compatibility Considerations

To modify the Java class path, create javaclasspath.txt or javalibrarypath.txt files. For more information, see The Static Path and Locating Native Method Libraries.

#### Functionality being removed or changed

FunctionalityWhat Happens When You Use This Functionality?Use This InsteadCompatibility Considerations

createCopy method of inputParser class

Warns

copy

Replace all instances of createCopy with copy.

hostid

Warns

See Solution 1–171PI on the MathWorks website for instructions on obtaining your hostid.

### Mathematics

#### scatteredInterpolant and griddedInterpolant support for extrapolation

• scatteredInterpolant is a new class for interpolating scattered data, and it returns extrapolated values by default when you evaluate at query points outside the convex hull.

• griddedInterpolant now returns extrapolated values by default when you evaluate at query points outside the domain of your sample grid.

#### Compatibility Considerations

scatteredInterpolant supports extrapolation by default. This behavior is different from that of TriScatteredInterp, which returns NaN when you evaluate at query points outside the convex hull using the 'linear' or 'natural' methods. To preserve the TriScatteredInterp behavior, set the ExtrapolationMethod property to 'none'. See the scatteredInterpolant reference page for more information.

griddedInterpolant previously returned NaN values when you queried points outside the domain of the sample points using the 'linear', 'cubic' or 'nearest' interpolation methods. Now all interpolation methods support extrapolation by default. To preserve the old behavior, set the ExtrapolationMethod property to 'none' when the interpolation method is 'linear', 'cubic' or 'nearest'. See the griddedInterpolant reference page for more information.

#### Syntax for ones, zeros, and other functions for creating arrays that match attributes of an existing variable

The functions ones, zeros, eye, Inf, NaN, true, false, and cast now can return an output that matches the data type, sparsity, and complexity (real or complex) of a variable p.

For example:

```p = uint8([1 2]);
X = ones(2,3,'like',p);
class(X)```
```ans =

uint8```

#### Integer type support for prod, cumsum, cumprod, median, mode, and number theory functions

The following functions now support inputs of any integer data type: median, mode, prod, cumprod, cumsum, isprime, primes, factor, gcd, lcm, perms, factorial, nextpow2, and nchoosek.

#### flintmax function for largest consecutive integer in floating-point format

Largest consecutive integer in floating-point format. flintmax returns the largest consecutive integer in IEEE® double precision, which is 2^53. Above this value, double-precision format does not have integer precision, and not all integers can be represented exactly. flintmax('single') returns the largest consecutive integer in IEEE single precision, which is single(2^24).

#### Scale option for airy function

scale is an optional flag you can pass to airy to scale the resulting Airy function. See the airy reference page for more information.

#### scatteredInterpolant class that replaces TriScatteredInterp

TriScatteredInterp will be removed in a future release. Use the new scatteredInterpolant class instead. The scatteredInterpolant class performs interpolation on 2-D and 3-D scattered data with support for extrapolation outside the convex hull of the sample points. scatteredInterpolant also supports queries in grid vector format to conserve memory.

#### Compatibility Considerations

• scatteredInterpolant supports extrapolation by default. This behavior is different from that of TriScatteredInterp, which returns NaN when you evaluate at query points outside the convex hull using the 'linear' or 'natural' methods. To preserve the TriScatteredInterp behavior, set the ExtrapolationMethod property to 'none'. See the scatteredInterpolant reference page for more information.

• scatteredInterpolant does not accept input of type DelaunayTri. Use nearestNeighbor or pointLocation to interpolate using a specific Delaunay triangulation. See Interpolation Using a Specific Delaunay Triangulation for more information.

• The scatteredInterpolant Points property is the array of sample point coordinates. The corresponding TriScatteredInterp property is called X. Use the Points property to refer to the sample points when you update your code.

#### triangulation class to replace TriRep

TriRep will be removed in a future release. Use the new triangulation class instead. The triangulation class represents 2-D and 3-D triangulations using a similar form and syntax as TriRep.

#### Compatibility Considerations

The property names and some method names have changed. The tables below map the current TriRep properties and methods to the triangulation replacements. Each replacement property has the same shape and holds the same values as the corresponding TriRep property. Similarly, each replacement method has the same syntax and returns the same result as the corresponding TriRep method.

Replacements for TriRep Properties

TriRep PropertyReplacement triangulation PropertyName Change
XPoints
TriangulationConnectivityList

Replacements for TriRep Methods

TriRep MethodReplacement triangulation MethodName Change
baryToCartbarycentricToCartesian
cartToBarycartesianToBarycentric
circumcenterscircumcenter
edgeAttachmentsedgeAttachments
edgesedges
faceNormalsfaceNormal
featureEdgesfeatureEdges
freeBoundaryfreeBoundary
incentersincenter
isEdgeisConnected
neighborsneighbors
sizesize
vertexAttachmentsvertexAttachments

#### delaunayTriangulation class to replace DelaunayTri

DelaunayTri will be removed in a future release. Use the new delaunayTriangulation class instead. delaunayTriangulation represents 2-D and 3-D Delaunay triangulations using a similar form and syntax as DelaunayTri.

#### Compatibility Considerations

Some of the property and method names have changed. The tables below map the current DelaunayTri properties and methods to the delaunayTriangulation replacements. Each replacement property has the same shape and holds the same values as the corresponding DelaunayTri property. Similarly, each replacement method has the same syntax and returns the same result as the corresponding DelaunayTri method.

Replacements for DelaunayTri Properties

DelaunayTri PropertyReplacement delaunayTriangulation PropertyName Change
ConstraintsConstraints
XPoints
TriangulationConnectivityList

Replacements for DelaunayTri Methods

DelaunayTri MethodReplacement delaunayTriangulation MethodName Change
convexHullconvexHull
inOutStatusisInterior
nearestNeighbornearestNeighbor
pointLocationpointLocation
voronoiDiagramvoronoiDiagram

#### Set functions behavior change

The behavior of unique, union, intersect, setdiff, setxor, and ismember has changed.

• If there are repeated elements in the input arrays, the functions unique, union, intersect, setdiff, and setxor return the index to the first occurrence of the repeated elements (or rows).

• The optional output array, locb, returned by ismember, contains the lowest absolute indices in B for elements (or rows) that are also in A.

• All index vectors returned by unique, union, intersect, setdiff, or setxor are column vectors.

• The shape of the output, C, from intersect, setxor, and union, when the 'rows' and 'legacy' flags are not specified, is as follows. C is column vector unless both A and B are row vectors, in which case C is a row vector.

• The shape of the output, C, from setdiff, when the 'rows' and 'legacy' flags are not specified, is as follows. C is a row vector if A is a row vector. Otherwise, C is a column vector.

• unique, union, intersect, setdiff, setxor, and ismember support objects.

• The input arrays passed to union, intersect, setdiff, setxor, and ismember must be of the same class with the following exceptions:

• Logical, char, and all numeric classes can combine with double arrays.

• Cell arrays of strings can combine with char arrays.

• ismember treats trailing white space in cell arrays of strings as distinct characters. For example, 'word' is different from 'word '. If the 'legacy' flag is specified, ismember ignores trailing white space and treats 'word' the same as 'word '.

#### Compatibility Considerations

If the changes adversely affect your code, you can specify 'legacy' to preserve the behavior from R2012b and prior releases. For example:

`[C,IA,IC] = unique([9 9 1])`
```C =

1     9

IA =

3
1

IC =

2
2
1
```
`[C2,IA2,IC2] = unique([9 9 1],'legacy')`
```C2 =

1     9

IA2 =

3     2

IC2 =

2     2     1
```

#### Functionality being removed or changed

FunctionalityWhat Happens When You Use This FunctionalityUse This InsteadCompatibility Considerations

Replace all instances of quad with integral.

For example, replace q = quad('x.*cos(x)',0,1) with q = integral(@(x)x.*cos(x),0,1).

If quad uses an absolute error tolerance, tol, replace all instances of the tolerance argument with the 'AbsTol' or 'RelTol' name-value pair arguments.

For example, replace q = quad(fun,a,b,tol) with q = integral(fun,a,b,'AbsTol',tol,'RelTol',tol).

Replace all instances of quadl with integral.

For example, replace q = quadl('x.*cos(x)',0,1) with q = integral(@(x)x.*cos(x,0,1).

If quadl uses an absolute error tolerance, tol, replace all instances of the tolerance argument with the 'AbsTol' or 'RelTol' name-value pair arguments.

For example, replace q = quadl(fun,a,b,tol) with q = integral(fun,a,b,'AbsTol',tol,'RelTol',tol).

quadvStill runsintegral with the 'ArrayValued',true name-value pair argumentReplace all instances of quadv with integral using the 'ArrayValued',true name-value pair argument.

Replace all instances of dblquad with integral2.

If there are discontinuities in the interior of the region of integration, replace dblquad with integral2 using the 'method','iterated' name-value pair argument.

Replace all instances of triplequad with integral3.

If there are discontinuities in the interior of the region of integration, replace triplequad with integral3 using the 'method','iterated' name-value pair argument.

bitmaxStill runsflintmaxReplace all instances of bitmax with flintmax.
TriRepStill runstriangulationReplace all instances of TriRep with triangulation. Most of the triangulation properties and methods are the same as those in TriRep, but there are a few exceptions. See triangulation class to replace TriRep for details.
DelaunayTriStill runsdelaunayTriangulationReplace all instances of DelaunayTri with delaunayTriangulation. Most of the delaunayTriangulation properties and methods are the same as those in DelaunayTri, but there are a few exceptions. See delaunayTriangulation class to replace DelaunayTri for details.
TriScatteredInterpStill runsscatteredInterpolant

Replace all instances of TriScatteredInterp with scatteredInterpolant. See scatteredInterpolant class that replaces TriScatteredInterp for compatibility details.

inlineStill runsAnonymous functionReplace all instances of inline with an anonymous function. See Anonymous Functions for more information. You can use symvar and func2str to convert your existing code.
rand or randn with the 'seed', 'state' or 'twister' inputs.Still runsrngFor more information about updating your code and assessing the impact of this change, see Updating Your Random Number Generator Syntax.
permute(A,order) where order contains noninteger or complex values.WarnsReal, positive integer values for orderReplace all instances of noninteger or complex valued inputs with real, positive integer values. You can use round or real for this conversion.
Noninteger valued size inputs for zeros, ones, eye, Inf, NaN, true, false, rand, randi, randn, and cellWarnsInteger valued size inputsReplace all instances of noninteger valued size inputs with integer valued size inputs for zeros, ones, eye, Inf, NaN, true, false, rand, randi, randn, and cell. You can use floor for this conversion.
cholinc(X,'inf')ErrorsNoneRemove all instances of cholinc(X,'inf') from your code.
All other syntaxes of cholinc except cholinc(X,'inf')ErrorsicholReplace these instances of cholinc with ichol.
luincErrorsiluReplace all instances of luinc with ilu.
sparse(A)
sparse(i,j,s,...)
where A and s are of type char.
sparse(i,j,double(s),...)
Convert all char inputs to double before calling sparse.
RandnAlg property of RandStream classErrorsNormalTransform property of RandStream classReplace all existing instances of RandnAlg with NormalTransform.
setDefaultStream method of RandStream classErrorssetGlobalStream method of RandStream classReplace all existing instances of RandStream.setDefaultStream with RandStream.setGlobalStream.
getDefaultStream method of RandStream classErrorsgetGlobalStream method of RandStream classReplace all existing instances of RandStream.getDefaultStream with RandStream.getGlobalStream.

### Graphics

#### gobjects function for preallocating graphics handle array

The gobjects function creates an array of graphics handles. Use this function instead of the ones or zeros function when preallocating an array to store graphics handles.

#### Functionality being removed or changed

FunctionalityWhat Happens When You Use This Functionality?Use This InsteadCompatibility Considerations

Figure DoubleBuffer property

No effect

No replacement needed

On older computer systems, was used to produced flash-free graph animations.

Use of ginput when MATLAB is started with the–noFigureWindow or –nodisplay flag

Errors

Not applicable

Do not use ginput when you start MATLAB with the –noFigureWindows or –nodisplay flags.

Use of graphics format extensions ai or ill with saveas

Warns

No replacement

Remove all instances of saveas with the ai or ill extensions.

Use of all option with hgsave or hgload

Warns

No replacement

Remove all instances of passing all to hgsave or hgload.

Use of getframe with second input argument that specifies an area not contained in figure window

Warns

No replacement

If using a second input argument with getframe, then specify an area fully contained in figure window.

Use of -dsetup option with print to display the Windows Print Setup dialog

Warns

No replacement

Remove all instances of -dsetup. For the current figure, click File > Print in the Figure window to display the Print Setup dialog.

### Data Import and Export

#### Reading and writing indexed and grayscale AVI files with VideoReader and VideoWriter objects

The VideoReader.read method now returns an array of grayscale data when reading grayscale AVI files. The read method also reads AVI files with indexed video and a colormap using the new 'native' input argument.

The VideoWriter.writeVideo method now writes grayscale AVI files, and AVI files with indexed video and a colormap.

#### Compatibility Considerations

A VideoReader object created from an AVI file with indexed video and a grayscale colormap now has a VideoFormat property with the value 'Grayscale'. By default, using the  VideoReader.read method to read this object returns an m-by-n-by-1-by-F array, where m is the image frame height, n is the image frame width, and F is the number of frames read. In R2012b and earlier releases, the value of VideoFormat was 'RGB24' and read by default returned an m-by-n-by-3-by-F array.

#### Writing MPEG-4 H.264 files on Mac with VideoWriter object

VideoWriter now writes MPEG-4 H.264 files with the extension .mp4 or .m4v on systems with Mac OS X 10.7 or later.

#### Tiff object improvements for reading and writing RGB-class TIFF images

The Tiff.readRGBAImage method returns RGBA data from an entire RGB-compatible image. The Tiff.readRGBAStrip and Tiff.readRGBATile methods return RGBA data from a single strip or a single tile in an RGB-compatible image, respectively.

The JPEGColorMode property for Tiff objects controls YCbCr/RGB conversion when writing YCbCr images. For more information, see the Tiff reference page.

#### Importing non-ASCII encoded files with textscan function

The textscan function now reads text files with non-ASCII encodings. For a complete list of supported encoding schemes and the syntax for specifying the encoding, see the fopen reference page.

#### Multichannel JP2 support in imread function

By default, when reading JP2 files, the imread function now returns all image channels in the order in which they exist in the codestream. In R2012b and earlier releases, imread read up to 3 channels only.

#### Compatibility Considerations

The default syntax of imread no longer reorders the channels of a JP2 image where the channels are out of order. To reorder the channels, call imread with the 'V79Compatible' name-value pair argument.

#### Previous behavior change of xlsread function output

In R2011b and earlier, the xlsread function returned columns of empty strings, '', in the text data output, where there were leading columns of numeric data preceding text data. As of R2012a, on systems with Excel® for Windows, these columns of empty strings are trimmed from the text data output.

#### Compatibility Considerations

This change in behavior affects file reading on systems with Excel for Windows, when calling xlsread without the 'basic' argument. For example, given a file, myfile.xls , where Sheet1 contains the following data:

```1	1	1	A	A
2	2	2	B	B
3	3	3	C	C
4	4	4	D	D
5	5	5	E	E
```

Calling [num,txt] = xlsread('myfile.xls','Sheet1') on systems with Excel for Windows returns:

```num =
1     1     1
2     2     2
3     3     3
4     4     4
5     5     5

txt =
'A'    'A'
'B'    'B'
'C'    'C'
'D'    'D'
'E'    'E'```

In R2011b and earlier, the command returned:

```num =

1     1     1
2     2     2
3     3     3
4     4     4
5     5     5

txt =

''    ''    ''    'A'    'A'
''    ''    ''    'B'    'B'
''    ''    ''    'C'    'C'
''    ''    ''    'D'    'D'
''    ''    ''    'E'    'E'
```

When reading XLS files, you can use the 'basic' flag to reproduce the pre-R2012a output:

`[num,txt] = xlsread('filename.xls',Sheet,'','basic');`

#### Authentication, user name, and password inputs for urlread and urlwrite functions

The urlread and urlwrite functions accept the following optional name-value pair arguments.

AttributeValue
AuthenticationHTTP authentication mechanism. Currently, only basic authentication is supported.

#### Additional audio and video file reading capabilities using Import Wizard and importdata function

The Import Wizard and the importdata function now import all audio file formats supported by the audioread function, including WAV, FLAC, and OGG files on all platforms, and MP3 and MPEG-4 AAC files on Windows 7 (or later), Macintosh, and Linux® platforms.

The Import Wizard and the importdata function now import all video file formats supported by the VideoReader class.

#### sound function nonblocking

The sound function now returns immediately. In R2012b and earlier releases, sound blocked until all audio played back.

#### Compatibility Considerations

To play audio with blocking, use playblocking(audioplayer(y,Fs)) instead of sound(y,Fs).

#### Functionality being removed or changed

FunctionalityWhat Happens When You Use This Functionality?Use This InsteadCompatibility Considerations
aufinfoStill runsaudioinfoReplace all instances of aufinfo with audioinfo.
auwriteStill runs Write audio files using audiowrite.
wavfinfoStill runsaudioinfoReplace all instances of wavfinfo with audioinfo.
wavwriteStill runsaudiowriteReplace all instances of wavwrite with audiowrite.
cdfwriteStill runs Write Common Data Format (CDF) files using the cdflib low-level functions.
hdftoolStill runs Read data from HDF files using hdfread or the low-level functions in the matlab.io.hdf4.sd, matlab.io.hdfeos.gd, and matlab.io.hdfeos.sw packages.

### Performance

#### fft function performance improvements on computers with new Intel and AMD processors

The fft function performance improves on computers with Intel and AMD processors supporting the AVX instruction set.

#### permute function performance improvements for 3-D and higher dimensional arrays

The permute function performance improves for 3-D and higher dimensional arrays.

## R2012b

New Features, Bug Fixes, Compatibility Considerations

### Desktop

#### Toolstrip that replaces menus and toolbars in MATLAB Desktop

• The Toolstrip contains components that were previously available in menus, toolbars, and the Start button. Tabs such as Home, Plots, Apps, Editor, and Variable, group functionality to support common tasks.

• The Apps tab contains a gallery of apps from the MATLAB family of products. You also can install your own apps, which appear in the apps gallery.

• The quick access toolbar contains frequently used options such as cut, copy, paste. The quick access toolbar is customizable; you can add items from tabs or from command shortcuts you create. You can also change the position of the toolbar on the Desktop.

• The current folder toolbar enables you to control the current working directory. The location and the controls available are customizable.

• The Search Documentation box enables you to search the documentation for functions and other topics of interest.

#### Apps gallery that presents apps from the MATLAB product family

The MATLAB desktop contains a gallery of apps from the MATLAB family of products. You can also install your own apps, which appear in the apps gallery.

• To access the apps gallery, on the desktop Toolstrip, click the Apps tab, and then, on the far right of the Apps section, click the arrow .

• To find and install apps written by others, click the Apps tab, and in the File section, click Get More Apps.

#### Single-file application packaging as a MATLAB App Installer file for inclusion in the apps gallery

You can package your GUI as a single installer file that contains all of the code and data needed to run your app, as well as a description of your app. Share your app with others by uploading the installer file to File Exchange or sending it as an email attachment. When your app installs, it appears alongside apps from the MathWorks family of products in the apps gallery. For more information, see Package Apps.

### Searching and navigation

The R2012b release includes a redesigned documentation system with streamlined product pages, detailed search suggestions, and enhanced filtering of search results.

Each product's documentation is now organized by categories of functionality, such as Graphics or Simulation, rather than by information type, such as Function Reference or User's Guide. Categories include links to related reference pages, examples, and conceptual topics, allowing you to browse from one to another.

Most features of the previous Help browser are available in the new browser, although some functionality has a different appearance or location. For example:

• The table of contents for each product is collapsed by default to maximize the space available for reading topics. Expand the table of contents from any page in the Help browser by clicking the Table of Contents button, .

• Links to alphabetical lists of reference pages, such as functions or blocks, appear at the bottom of each product page.

• Tasks previously performed using menu items in the Help browser, such as setting preferences or viewing page locations, are now accessible via context (right-click) menus, keyboard shortcuts, or toolbar buttons.

 Note:   On Macintosh systems, there are no context menu items for Evaluate Selection or Get Page Address. You can copy selected code to the Command Window for evaluation by pressing Shift+F7. However, in this release, there is no way to identify the page address.
• Demos are now labeled Examples, and are accessible from the top of each product page. When you select video examples, they open in your system Web browser.

• All release notes for a product appear on the same page, allowing you to track changes across several releases from a single location.

The new Help browser is used exclusively for the documentation of MathWorks products. As a result:

• The web command opens all pages that are not part of the documentation in the MATLAB Web browser, even when you specify the -helpbrowser option. Because this is the default behavior of the web command, the -helpbrowser option has been removed from the documentation.

• When the doc command does not find a documentation page, but does find associated help text, it displays the text in the MATLAB Web browser rather than the Help browser.

• Custom documentation and documentation for downloadable or third-party products displays in a separate browser. To access this browser, open the Help browser and navigate to the documentation home page. Then, at the bottom of the page, click Supplemental Software.

### Font size in Help browser and Web browser

The Help browser and Web browser now allow you to zoom in and out to adjust the font size by pressing Ctrl and + or .

From within the product, you can access either the installed documentation or the documentation on the Web. By default, your Help preference is set to view the installed documentation. If you change the preference to view the Web documentation, then you can choose to view documentation for products that you do not have installed.

### Searches using the doc command

In previous releases, if you passed a term to the doc command that did not correspond to the name of a MathWorks reference page or to a file with help text, the doc command issued an error. Now, the doc command searches the documentation for the term, and displays the search results in the Help browser.

### Improved rendering in Help browser and Web browser

The new Help browser uses a different rendering engine than the previous Help browser. This engine provides improved legibility, particularly on Microsoft Windows 64-bit systems.

The MATLAB Web browser also uses this rendering engine on all platforms. In previous releases, the Web browser used this engine only on Microsoft Windows systems.

This rendering engine is not fully supported on Red Hat® 5 operating systems, so not all Help features are available on those systems. For example:

• Search suggestions are available from the search bar in the desktop, but not within the Help browser.

• Some components of the search results page are not available, such as filtering.

• The Help browser can display installed product documentation, but not the documentation on the Web.

#### Compatibility Considerations

• The Help system now requires that custom documentation files reside outside the matlabroot folder (but on the MATLAB search path). To view any installed custom documentation, open the Help browser and navigate to the documentation home page. Then, at the bottom of the page, click Supplemental Software.

• The demo command no longer supports categories of MATLAB or Simulink examples.

• For some products (primarily third-party toolboxes), the demo command requires different input values to specify the product type or name. The demo command now identifies each product using its info.xml file rather than its demos.xml file. For most MathWorks products, the product information is the same in both files.

• In a future release, MathWorks will remove support for demos.m files, an old way to include demos in the Help browser. For the recommended method, see Display Custom Examples.

#### Viewing of multiple documentation pages simultaneously with tabbed browsing

The Help browser now allows you to open multiple tabs so that you can view more than one documentation topic at a time. Open a new tab by clicking the New Tab button, , or by right-clicking a link.

#### Suggested corrections for mistyped functions and variables in the Command Window

MATLAB can show suggestions in the Command Window for misspelled functions and variable names. If you enter an undefined function or variable name, MATLAB displays:

`Did you mean:`

followed by a suggested command at the command line. You can press Enter to execute that command, or Esc to delete the suggestion.

#### Full-screen view mode on Mac operating systems

MATLAB can operate in full-screen mode on Mac OS X 10.7 Lion.

#### Changes to -nojvm startup option on Mac

When you start MATLAB on a Mac with the -nojvm startup option, Handle Graphics functionality is no longer supported. MATLAB will produce an error. Previous to this release, calls to Handle Graphics functionality would work but generate a warning. (For more information about the -nojvm option, see the matlab (UNIX) reference page.)

#### Tabs in MATLAB Web browser

The MATLAB Web browser now allows you to open multiple tabs so that you can view multiple reports or Web sites simultaneously. Open a new tab by clicking the New Tab button, .

#### Direct access to run configurations from the Run button

Now you can type commands directly using the Run options on the Editor tab.

In previous versions, you accessed run configurations by clicking the Run button down arrow and selecting Edit Run Configurations for filename.

#### Compatibility Considerations

MATLAB R2012b does not automatically copy run configurations from versions prior to R2012b. To transfer run configurations from a release prior to the MATLAB R2012b installation:

1. Open prefdir\run_configurations.m. To identify your preference directory, type prefdir in the Command Window.

Run configuration entries appear similar to this example:

```%% @name foo
%  @associatedFile C:\Documents\MATLAB\work\foo.m
%  @mostRecentlyActioned true
%  @uniqueId 695644b0:1355f0bb372:-7fb0

% Modify expression to add input arguments.
% Example:
%   a = [1 2 3; 4 5 6];
%   foo(a);
foo(1,2)```
2. Copy the MATLAB command in the run configuration. In the example configuration, the command is foo(1,2).

3. Open the MATLAB file associated with the run configuration that you want to keep. In the example configuration, the file is C:\Documents\MATLAB\work\foo.m.

4. Click and then the field containing type code to run.

5. Paste the MATLAB command.

If the MATLAB expression spans multiple lines, create a script, and copy and paste the code into the script. You can then run the script directly using .

#### Multiple vector creation from single selection in Variables editor

The Variables editor now allows you to create one or more new row or column vectors from a single selection within an existing variable. The names of the new variables are based on the name of the existing variable. Previously, the Variables editor could only create a new array from a single selection, and new variables were called unnamed, unnamed1, …, unnamedN.

### Language and Programming

#### Abstract attribute for declaring MATLAB classes as abstract

Declare MATLAB classes as abstract by setting the class Abstract attribute. See Defining Abstract Classes for more information.

#### Diagnostic message improvements when attempting to create an instance of an abstract class

Attempting to instantiate an abstract class returns a list of abstract members and their defining classes in the error diagnostic message. The meta.abstractDetails function finds abstract members defined or inherited by abstract classes.

#### Handle and dynamicprops do not support the empty static method

For R2012b, the handle and dynamicprops classes no longer support the empty static method. This change makes these classes consistent with all MATLAB abstract classes.

#### Compatibility Considerations

MATLAB software issues an error for calls to the empty static method from the handle and dynamicprops classes:

```% Will return errors
handle.empty
dynamicprops.empty```

See Creating Empty Arrays for information on using empty.

#### Switch uses eq to compare enumerations

Switch statements use the enumeration eq method to compare the switch expression with the case expression (see switch). In previous releases, switch used a special comparison that required the result of both expressions to belong to the same enumeration class. The result of the comparison is determined by the result of:

`switch_experssion == case_expression`

The new behavior is consistent with that of other conditional statements, such as if statements.

#### Compatibility Considerations

Code that uses enumerations in switch statements can behave differently in release R2012b than in a previous release.

#### Cannot specify property attributes multiple times

Classes can define a property attribute only once in a properties block. Defining the same attribute more than once in a properties block causes an error when the class is instantiated.

#### Compatibility Considerations

Classes that define the same property attribute multiple times in a properties block will error when attempting to instantiate the class. Previously, MATLAB evaluated property attribute specifications in right to left order.

#### Discontinued compiler support for building MEX-files

MATLAB no longer supports the following compilers on Linux 32-bit platforms:

• GNU® gcc Version 4.4.x

• GNU gfortran 4.3.x

#### Compatibility Considerations

To ensure continued support for building your MEX-files, consider upgrading to another supported compiler. For an up-to-date list of supported compilers, see the Supported and Compatible Compilers Web page.

#### Jagged array support for .NET

MATLAB does not support:

#### Java exceptions accessible to MATLAB code

If you call a Java method from MATLAB, and that code throws an exception, use the matlab.exception.JavaException class to handle the exception in MATLAB.

#### Ability to add jar files to static Java class path

To use third-party Java libraries in MATLAB, you can control the Java class path and native library path by creating javaclasspath.txt and javalibrarypath.txt files. For more information, see The Static Path and Locating Native Method Libraries.

#### Preservation of string functions for backwards compatibility

The R2010a Release Notes originally stated that the isstr, setstr, str2mat, strread, strvcat, and textread functions would be removed in a future release. As of R2012b, there are no plans to remove these functions. However, use of these functions is not recommended.

FunctionRecommended Modification
isstrReplace all existing instances of isstr with ischar.
setstrReplace all existing instances of setstr with char.
str2matReplace all existing instances of str2mat with char.
strreadReplace all existing instances of strread with textscan. For example, replace
[a,b,c] = strread(...) with
```C = textscan(...)
[a,b,c] = deal(C{:})```
Unlike strread, the textscan function converts numeric values to the specified data type, allowing preservation of integer types.
strvcatReplace all existing instances of strvcat with char. Unlike strvcat, the char function does not ignore empty strings.
textreadReplace all existing instances of textread with textscan, similar to strread. Open and close files with fopen and fclose.

#### Conversion of Error and Warning Message Identifiers

For R2012b, error and warning message identifiers have changed in MATLAB.

#### Compatibility Considerations

If you have scripts or functions that use message identifiers that changed, you must update the code to use the new identifiers. Typically, message identifiers are used to turn off specific warning messages, or in code that uses a try/catch statement and performs an action based on a specific error identifier.

For example, the MATLAB:uitable:InvalidParent identifier has changed to MATLAB:uitable:ParentMustBeFigureOrUIContainer. If your code checks for MATLAB:uitable:InvalidParent, you must update it to check for MATLAB:uitable:ParentMustBeFigureOrUIContainer instead. For a mapping of the new identifiers to the original identifiers, see Technical Support solution 1-ERAFNC.

### Mathematics

#### Performance improvements and multithreading for airy, psi, and Bessel functions

The following functions show improved performance: besselh, besseli, besselj, besselk, bessely, airy, and psi.

#### ddensd function that solves delay differential equations of neutral type with state-dependent delays

The ddensd function solves neutral delay differential equations that involve both the solution and its first derivative evaluated in the past:

y '(t) = f(t, y(t), y(dy1),...,y(dyj), y '(dyp1),...,y '(dypk))

The delays, dy and dyp, can be time-dependent, state-dependent, or both.

#### Signed integer support for bit-wise operations

The bitand, bitor, bitxor, bitcmp, bitshift, bitget, and bitset, functions now support signed integers.

An additional input argument, assumedtype, is an optional string argument you can pass to any of these functions. Use assumedtype to indicate the assumed integer class for input values of type double. For example, bitor(14,240,'uint8') treats 14 and 240 as unsigned 8-bit integers even though they are passed as integers of type double.

assumedtype can be one of the following strings: 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', or 'uint64'. The default value of assumedtype is 'uint64' for input values of type double. If the input values belong to an integer class, assumedtype defaults to the class of the input values.

#### atan2d function that calculates four-quadrant inverse tangent with result in degrees

atan2d calculates the four-quadrant inverse tangent and returns angles in degrees that lie in the closed interval [–180,180].

#### Complex number support for trigonometry degree functions

The sind, cosd, tand, asind, acosd, atand, cscd, cotd, secd, acscd, asecd, and acotd functions now support complex values. For example, sind(10+i) returns 0.1737 + 0.0172i. Likewise, asind(2) now returns the complex angle 90.0000 -75.4561i.

#### Functionality being removed or changed

FunctionalityWhat Happens When You Use This FunctionalityUse This InsteadCompatibility Considerations
bitshift(A,k,N)Still Runsbitshift(A,k,assumedtype)Replace all instances of bitshift(A,k,N) with bitshift(A,k,assumedtype).
bitcmp(A,N)Still Runsbitcmp(A,assumedtype)Replace all instances of bitcmp(A,N) with bitcmp(A,assumedtype).
bitshift(A,k) where A is of typedouble.Still runsNot Applicablebitshift now interprets double input as uint64 instead of 53-bit signed integer by default. For example, bitshift(1,54) now returns 1.8014e+16 instead of 0.
mimofrWarnsNot ApplicableRemove all instances of mimofr from your existing code.
Second output argument for besselh, besseli, besselj, besselk, bessely, and airy. For example, [J,ierr] = besselj(nu,Z).ErrorsSyntax that returns only the solution vector. For example, J = besselj(nu,Z).Replace all instances that return two output arguments with the syntax that returns only the solution vector.
Passing mixed-orientation input vectors to besselh, besseli, besselj, besselk, and bessely. For example, passing a row vector followed by a column vector:
`J= besselj(rowNu, colZ)`
or passing a column vector followed by a row vector:
`J= besselj(colNu, rowZ)`
Errors

First construct the inputs with ndgrid or meshgrid. Alternatively, you can pass a function handle and the mixed-orientation vectors to bsxfun.

Modify all instances that pass mixed-orientation vectors. You can modify your code in one of two ways:
• Call meshgrid or ndgrid to construct the full grid first.

```[nu,Z]= meshgrid(rowNu, ColZ);
J= besselj(nu, Z);```
• Pass a function handle and the mixed-orientation vectors to bsxfun. For example, if your existing code passes a row vector followed by a column vector, make the following change:

J= bsxfun(@besselj, rowNu, colZ);or, if your code passes a column vector followed by a row vector, make the following change:

J= bsxfun(@besselj, colNu', rowZ.');

Y = psi(k0:k1,X)ErrorsY = psi(k,X) where k is a scalar specifying the kth derivative of ψ at the elements of X.Replace all instances of Y = psi(k0:k1,X) with Y = psi(k,X), where k is a scalar. To modify your code, loop through the values k0:k1. For example:
```for k=k0:k1
Y(:,k) = psi(k,X);
end```
In the future, size(Y) will be size(X). Modify any code that depends on size(Y).
Passing empty and nonscalar input to besselh, besseli, besselj, besselk, bessely, and airy. For example,
`J = besselj([],(1:3))`
or
`J = besselj((1:3),[])`
ErrorsJ = besselj(nu,[]) or J = besselj([],Z) where nu and Z are scalars.Modify all instances that pass combinations of empty arrays with nonscalar input. The inputs must be the same size or one must be a scalar.

### Data Import and Export

#### Data import from delimited and fixed-width text files using Import Tool

The Import Tool now allows you to preview data in delimited and fixed-width text files and select ranges of data to import. You also can define rules for handling nonnumeric values, and import data as column vectors, a matrix, a cell array, or a dataset array, in a single step. This tool opens instead of the Import Wizard for text files.

#### Single-step import of numbers, text, and dates as column vectors from a spreadsheet with Import Tool

The Import Tool now allows you to import columns of numeric data, text, and dates from spreadsheets as multiple column vectors in one step. Previously, this functionality was available for numeric data only.

#### audioread and audioinfo functions for reading MP3, MPEG-4 AAC, WAVE, and other audio files

The audioread and audioinfo functions read and provide information about MP3, MPEG-4 AAC, WAVE, OGG, and FLAC files on all platforms.

audioread is a drop-in replacement for the most common forms of wavread and auread. In most cases where you use wavread or auread, you can rename instances of these functions to audioread.

#### audiowrite function for writing MPEG-4 AAC, WAVE, and other audio files

The audiowrite function writes data to WAVE, OGG, and FLAC files on all platforms. audiowrite writes data to MPEG-4 AAC files on Windows and Mac platforms.

audiowrite is a drop-in replacement for the most common forms of wavwrite. In most cases where you use wavwrite, you can rename instances of this function to audiowrite.

#### Reading and writing of BigTIFF image files larger than 4 GB

MATLAB now supports BigTIFF image files larger than 4 GB. You can use imread or the Tiff object.

#### Reading of XLSM, XLTX, and XLTM files on all platforms with xlsread function

The xlsread function now reads data from XLSM, XLTX, and XLTM files on all platforms. Previously, this functionality was available only on Microsoft Windows systems with Excel software.

#### xlsread function now supporting named ranges on all platforms

The xlsread function now supports named ranges as inputs, on all platforms. For example, you can call

`num = xlsread(filename,sheet,xlRange);`

where xlRange refers to a named range of data in your Excel workbook. Previously, this functionality was available only on Microsoft Windows systems with Excel software.

#### Multiple delimiter support in textscan function

The textscan function recognizes multiple different delimiters within a single file. textscan also can treat multiple repeated delimiter characters as a single delimiter.

#### Timeout, user agent, and character encoding inputs for urlread and urlwrite functions

The urlread and urlwrite functions accept the following optional attribute-value pair arguments.

AttributeValue
TimeoutTimeout duration
UserAgentClient user agent identification
CharsetCharacter encoding, determined from the headers of the file

For example, to download Web content from a the MATLAB Central File Exchange while specifying a timeout duration of 5 seconds, type

`urlread(‘http://www.mathworks.com/matlabcentral/fileexchange','Timeout',5);`

#### Functionality being removed or changed

FunctionalityWhat Happens When You Use This Functionality?Use This InsteadCompatibility Considerations
avifileWarnsVideoWriterReplace all instances of avifile with VideoWriter.
wavplayWarns audioplayer and playReplace all existing instances of wavplay with audioplayer and play.
wavrecordWarnsaudiorecorder and recordReplace all existing instances of wavrecord with audiorecorder and record.
wk1finfoErrors Remove all instances of wk1finfo. Get information about Excel spreadsheets with xlsfinfo.
wk1writeErrors Remove all instances of wk1write. Write to Excel spreadsheets with xlswrite.

## R2012a

New Features, Bug Fixes, Compatibility Considerations

### Desktop Tools and Development Environment

#### Transpose and Sort Variables in the Variable Editor

To transpose or sort variables, use the right-click menu options in the Variable Editor. You can sort variables based on single or multiple column selections. The columns you select can be noncontiguous and should always include all the rows. Also, you can create variables from noncontiguous data selections. For more information see the New Variable Editor Features in Release 2012aNew Variable Editor Features in Release 2012a demo.

#### MATLAB Dock Menu on Mac Includes New Capabilities

Previously, on a Mac, the Dock menu associated with the MATLAB icon included only the default options, such as Hide/Show and Quit. Now, consistent with the behavior of most Mac applications, the MATLAB Dock menu lists open windows and documents associated with the running MATLAB application. By choosing on any of the entries in the Dock menu, you can bring that window or document to the front. To view the Dock menu, right-click the MATLAB icon in the Dock or Ctrl+click the icon, if you have a one-button mouse.

In addition, the MATLAB Dock menu includes a new option, named Open Additional Instance of MATLAB, that is a convenient way to start another instance of MATLAB running on your computer.

The following figure shows the MATLAB Dock menu with a document open in the MATLAB Editor.

#### Improved Rendering in MATLAB Web Browser

The MATLAB Web browser uses a new HTML rendering engine on Microsoft Windows systems. This new engine provides better rendering, particularly on 64-bit systems. This update impacts the display of HTML from these sources:

• web commands

• Published MATLAB file output

• Folder reports from the Current Folder browser

#### Technical Support Requests Use Proxy Settings

You can submit Technical Support requests from MATLAB by selecting Help > Submit a MathWorks Support Request. In previous releases, if you were connected to the Internet via a proxy server, you had to save the request form to a text file, and then email it to MathWorks. Starting with R2012a, you can submit the request directly from the form.

#### Published Code Can Display Syntax Highlighted Sample Code

When you publish MATLAB code, you can have sample code appear with syntax highlighting. Sample code is code that appears within comments. Previously, only uncommented code appeared with syntax highlighting.

#### Compatibility Considerations

Previously, to publish preformatted text (without syntax highlighting), MATLAB required two or more spaces between the comment character (%) and the first text character in a code cell comment block. Now, to publish such text, there must be two, four, or more spaces in that location. Three spaces results in syntax highlighted sample code.

#### The publish Function Accepts Name-Value Pairs

You can customize the output from the publish function using Name-Value pair arguments. Previously, to customize the output from this function, you had to use a structure. You now can use either a structure or Name-Value pair arguments. For details, see publish.

### Displaying Non-7-Bit ASCII Characters on Mac OS X Platforms

On Apple Mac OS X platforms, you might see garbled text if you try to use non-7-bit ASCII characters. For example, if you create a variable in the MATLAB command window containing these characters, you can type the characters, but if you display the contents of the variable, the characters are corrupted.

Or if you share MATLAB text files with a user on a computer with different locale settings, they might see corrupted text. The characters are rendered in that user's locale, not the language it was written in.

MATLAB text files include scripts and user-defined functions and classes. MATLAB displays characters in a text file using an encoding scheme, which is defined in the MathWorks locale database. This encoding scheme supports characters for the language specified by the user locale setting. If you try to use non-7-bit ASCII characters in a text file, you might have to use a different encoding scheme. UTF-8 is often used to handle multilingual characters. Beginning in R2011b, to handle non-7-bit ASCII characters, you can change the default encoding scheme to UTF-8 by switching the MathWorks locale database. Note that changing the default encoding scheme might cause characters other than 7-bit ASCII characters in existing text files to be garbled.

See How the MATLAB Process Uses Locale Settings for more information.

#### How to Change MATLAB's Default Encoding to UTF-8

If you have text files containing non-7-bit ASCII characters, you must convert the encoding in the files before changing the default encoding on your computer. For instructions, see How to Convert Text File Encoding to UTF-8.

You can change the default encoding scheme on Mac OS X platforms by using the UTF-8 locale database found in the matlabroot/bin folder.

To change the default locale database, type:

```mldir = fullfile(matlabroot,'bin');
copyfile(fullfile(mldir,'lcdata.xml'),...
fullfile(mldir,'lcdata_default.xml'));
copyfile(fullfile(mldir,'lcdata_utf8.xml'),...
fullfile(mldir,'lcdata.xml'));
```

Alternatively, you can change the default locale database by setting an environment variable on your computer.

1. Set the environment variable, MWLOCALE_LCDATA_FILENAME, with the UTF-8 version of the locale database name, lcdata_utf8.xml, in the environment file, environment.plist. Please see this article from the Mac OS X Developer Library, Technical Q&A QA1067 "Setting environment variables for user processes" at http://developer.apple.com/library/mac/#qa/qa1067/_index.html.

2. Close MATLAB if it is currently running.

3. Start MATLAB by double-clicking the MATLAB icon in the Applications folder.

#### How to Convert Text File Encoding to UTF-8

Before converting a file, copy the file to a new directory.

Use the Mac OS X TextEdit application to convert the file encoding. For example:

1. Open a MATLAB text file with TextEdit.

2. Select File -> Save as...

3. Change the file name.

4. Change Plain Text Encoding: to Unicode (UTF-8).

5. Save the file.

Alternatively, the following MATLAB function, convert_file_encoding, creates a new text file with different encoding.

```function convert_file_encoding(infile,outfile,from_encoding,to_encoding)

if strcmp(infile(end-2:end),'mdl');
isMDL = 1;
else
isMDL = 0;
end

fpIn = fopen(infile,'r','n',from_encoding);
fpOut = fopen(outfile,'w','n',to_encoding);

while feof(fpIn) == 0
lineIn = fgets(fpIn);
if isMDL && strncmp('SavedCharacterEncoding',strtrim(lineIn),22)
lineIn = regexprep(lineIn,from_encoding,to_encoding);
end

fwrite(fpOut,lineIn,'char');
end

fclose(fpIn);
fclose(fpOut);
end```

To use this function, you need to know the current encoding, from_encoding.

• For MATLAB R2010b or later:

```ret = feature('locale');
from_encoding = ret.encoding;
```
• For MATLAB R2008a through R2010a:

```ret = feature('locale');
[t,r] = strtok(ret.ctype,'.');
from_encoding = r(2:end);
```

For example, a file, myFile.m, was created with MATLAB encoding set to ISO-8859-1. To convert the file to UTF-8, type:

`convert_file_encoding('myFile.m','myFileUTF8.m','ISO-8859-1','UTF-8')`

#### Compatibility Considerations

In a future release, the UTF-8 version of the MathWorks locale database will be the default on Mac OS X systems. Any text file created in MATLAB that is encoded in the user default encoding and contains characters other than 7-bit ASCII characters must be converted to the UTF-8 encoding scheme. Otherwise, MATLAB and other MathWorks products might not be able to properly load the files.

You must convert the file encoding before changing the default locale database.

Do not convert text files to UTF-8 if you share them with users on Windows platforms.

### Mathematics

#### New Integral Functions

The new functions, integral, integral2, and integral3 perform numerical integration with additional support for nonrectangular and unbounded regions of integration. They are the recommended functions for performing quadrature.

#### Performance Enhancements

The following functions show improved performance:

• Arithmetic and similar basic math functions for double, single, and integer data types.

• The grid-based interpolation functions, interp2, interp3, and interpn.

• Generating random values using either rng('combRecursive') or RandStream('mrg32k3a').

#### griddata Supports 3-D Data and Natural Neighbor Interpolation

griddata is now the recommended function for interpolating 2-D and 3-D scattered data. griddata also has a new method option, 'natural', for specifying natural neighbor interpolation.

#### TriScatteredInterp Accepts Complex Values

You can now use TriScatteredInterp to interpolate complex scattered data in a single pass. For example, F = TriScatteredInterp(X,V) now accepts a complex vector V.

#### Set Functions Provide Option to Return Sets in Original Order

You now can specify the ordering of the output array returned by the functions unique, union, intersect, setdiff, and setxor. The new argument, setOrder, is one of two strings, 'stable' or 'sorted'. Specify 'stable' if you want the elements in the output array to be in the same order as in the input array. For example:

C = unique([9 2 2],'stable') returns C = [9 2].

Specify 'sorted' if you want the elements in the output array to be in sorted order. For example:

C = unique([9 2 2],'sorted') returns C = [2 9].

#### Set Functions Changing Behavior in a Future Release

In a future release, the behavior of unique, union, intersect, setdiff, setxor, and ismember will change.

• If there are repeated elements in the input arrays, the functions unique, union, intersect, setdiff, and setxor will return the index to the first occurrence of the repeated elements (or rows).

• The optional output array, locb, returned by ismember, will contain the lowest absolute indices in B for elements (or rows) that are also in A.

• All index vectors returned by unique, union, intersect, setdiff, or setxor will be column vectors.

• unique and union will support objects with methods sort (sortrows for the 'rows' option), and ne. This includes heterogeneous arrays derived from the same root class.

• intersect, setdiff, setxor, and ismember will support objects with methods sort (sortrows for the 'rows' option), ne, and eq. This includes heterogeneous arrays derived from the same root class.

• The input arrays passed to union, intersect, setdiff, setxor, and ismember must be of the same class with the following exceptions:

• Logical, char, and all numeric classes can combine with double arrays.

• Cell arrays of strings can combine with char arrays.

 Note:   The set functions already conform to this behavior when you call them with the new setOrder argument.

#### Compatibility Considerations

The new behavior change is introduced for adoption in R2012a. If you want to assess the impact this change might have on your existing code, specify 'R2012a' as the final input argument to unique, union, intersect, setdiff, setxor, and ismember. For example:

`[C,IA,IC] = unique([9 9 1],'R2012a')`
```C =

1     9

IA =

3
1

IC =

2
2
1
```

If the changes adversely affect your code, you can specify 'legacy' to preserve the current behavior. For example:

`[C,IA,IC] = unique([9 9 1],'legacy')`
```C =

1     9

IA =

3     2

IC =

2     2     1
```

#### Interpolation and Computational Geometry Functionality Being Removed or Changed

FunctionalityWhat Happens When You Use This FunctionalityUse This InsteadCompatibility Considerations
interp1qStill Runsinterp1Replace all instances of interp1q with interp1.
interp1(..., 'cubic')Still Runsinterp1(..., 'pchip')Replace all instances of interp1(..., 'cubic') with interp1(..., 'pchip').
Passing nonuniformly spaced points or grid to:
```interp1(..., 'v5cubic')
interp2(..., 'cubic')
interp3(..., 'cubic')
interpn(..., 'cubic') ```
Warns
```interp1(..., 'spline')
interp2(..., 'spline')
interp3(..., 'spline')
interpn(..., 'spline') ```
In previous releases, interp1, interp2, interp3, and interpn silently changed the 'v5cubic' and 'cubic' methods to 'spline' when the sample data was not uniformly spaced. Now, a warning is issued if the uniformity conditions are not honored. To avoid the warning message, change any instances that call for'v5cubic' or 'cubic' to the 'spline' method.
Passing the 'pp' flag to interp1. For example:

pp = interp1(x, v, 'linear', 'pp');
vq = ppval(pp, xq);
Still RunsUse griddedInterpolant to create an interpolating function that is efficient to evaluate in a repeated manner. Replace all instances of interp1(..., 'pp') with griddedInterpolant. For example:

F = griddedInterpolant(x, v, 'linear');
vq = F(xq);
interp1(X, Y, Xq, [], ...) where [] specifies the default interpolation method Still Runsinterp1(X, Y, Xq, 'linear', ...)Replace all instances of interp1(X, Y, Xq, [], ...) with interp1(X, Y, Xq, 'linear', ...).
interp1(x,V,..) where x is a vector and V is an array representing multiple value sets. For example:
```x = (1:5)';
V = [x, 2*x, 3*x];
xq = (1:0.5:5)';
Vq = interp1(x, V, xq);```
Still RunsUse griddedInterpolant and loop over each value set, updating and evaluating during each iteration.Replace all instances of interp1(x,V,...), where x is a vector and V is an array representing multiple value sets. Loop over V, calling griddedInterpolant on each value set. The following example code shows how to set up and interpolate over three value sets in V :

x = (1:5)';
V = [x, 2*x, 3*x];
xq = (1:0.5:5)';
F = griddedInterpolant(x, V(:,1));
for n=1:3
F.Values = V(:, n);
Vq(:, n) = F(xq);
end

The columns of Vq are the interpolation results for the corresponding columns of V.
Passing mixed orientation vectors to interp2:

Vq = interp2(x, y, V, xq, yq)

Specifically, if one or both of the following are true:
• One of x and y is a row vector and the other is a column vector.

• One of xq and yq is a row vector and the other is a column vector.

Still Runs

Construct the full grid with meshgrid first. Alternatively, use griddedInterpolant if you have a large data set.

Modify all instances that pass mixed orientation vectors to interp2. You can modify your code in one of two ways:
• Call meshgrid to construct the full grid first.

[X,Y] = meshgrid(x, y);
[Xq,Yq] = meshgrid(xq, yq);
Vq = interp2(X, Y, V, Xq, Yq);

• Pass the vectors to griddedInterpolant inside a cell array.
F = griddedInterpolant({x, y}, V.');
Vq = (F({xq, yq})).'

Passing mixed orientation vectors to interp3:

interp3(x, y, z, V, xq, yq, zq)

Specifically, if one or both of the following are true:
• x, y, and z are a combination of row and column vectors.

• xq, yq, and zq are a combination of row and column vectors.

Still Runs

Construct the full grid with meshgrid first. Alternatively, use griddedInterpolant if you have a large data set.

Modify all instances that pass mixed orientation vectors to interp3. You can modify your code in one of two ways:
• Call meshgrid to construct the full grid first.

[X,Y,Z] = meshgrid(x, y, z);
[Xq,Yq,Zq] = meshgrid(xq, yq, zq);
Vq = interp3(X, Y, Z, V, Xq, Yq, Zq);

• Pass the vectors to griddedInterpolant inside a cell array.

V = permute(V, [2 1 3]);
F = griddedInterpolant({x, y, z}, V);
Vq = F({xq, yq, zq});
Vq = permute(Vq, [2 1 3]);

Passing mixed orientation vectors to interpn:

interpn(x1,x2,...,xn, V, x1q,x2q,...,xnq)

Specifically, if one or both of the following are true:
• x1,x2,...,xn are a combination of row and column vectors.

• x1q,x2q,...,xnq are a combination of row and column vectors.

Still Runs

Construct the full grid with ndgrid first. Alternatively, use griddedInterpolant if you have a large data set.

Modify all instances that pass mixed orientation vectors to interpn. You can modify your code in one of two ways:
• Call ndgrid to construct the full grid first.

[X1,X2,...,Xn]= ndgrid(x1,x2,...,xn);
[X1q,X2q,...,Xnq]= ndgrid(x1q,x2q,...,xnq);
Vq= interpn(X1,X2,...,Xn, V, X1q,X2q,...,Xnq);

• Pass the vectors to griddedInterpolant inside a cell array.

F= griddedInterpolant({x1, x2,...,xn}, V);
Vq= F({x1q, x2q,...,xnq});

```interp1(..., *METHOD)
interp2(..., *METHOD)
interp3(..., *METHOD)
interpn(..., *METHOD)```

Still Runs

Errors for invalid input data

```interp1(..., METHOD)
interp2(..., METHOD)
interp3(..., METHOD)
interpn(..., METHOD)```
In previous releases, interp1,interp2,interp3, and interpn provided a *METHOD option that bypassed error checking on the assumption of valid data. These checks are no longer bypassed. Use the griddedInterpolant class to perform repeated interpolation queries on the same data set without penalty of repeated error checks.
vq= griddata(x,y,v,xq,yq) where xq is a row vector and yq is a column vector.Still Runsvq= griddata(x,y,v,Xq,Yq) where Xq and Yq are the output arrays returned by meshgrid.Modify all instances that pass mixed orientation vectors to griddata. To specify a grid of query points, construct a full grid with meshgrid before calling griddata.
griddata3ErrorsgriddataReplace all existing instances of griddata3 with griddata.
delaunay3ErrorsdelaunayReplace all existing instances of delaunay3 with delaunay.
tsearchErrorsDelaunayTri/pointLocationReplace all existing instances of tsearch with DelaunayTri/pointLocation.
dsearchErrorsDelaunayTri/nearestNeighborReplace all existing instances of dsearch with DelaunayTri/nearestNeighbor.
convhull(..., OPTIONS)ErrorsOmit the OPTIONS argument when you call convhull.Remove the OPTIONS argument from all instances that pass it to convhull.
delaunay(..., OPTIONS)ErrorsOmit the OPTIONS argument when you call delaunay.Remove the OPTIONS argument from all instances that pass it to delaunay.
griddata(..., OPTIONS)ErrorsOmit the OPTIONS argument when you call griddata.Remove the OPTIONS argument from all instances that pass it to griddata.
voronoi(..., OPTIONS)ErrorsOmit the OPTIONS argument when you call voronoi.Remove the OPTIONS argument from all instances that pass it to voronoi.

#### Other Functionality Being Removed or Changed

FunctionalityWhat Happens When You Use This FunctionalityUse This InsteadCompatibility Considerations
isequalwithequalnansStill RunsisequalnReplace all instances of isequalwithequalnans with isequaln.
mimofrStill RunsNot ApplicableRemove all instances of mimofr from your existing code.
RandnAlg property of RandStream classWarnsNormalTransform property of RandStream classReplace all existing instances of RandnAlg with NormalTransform.
setDefaultStream method of RandStream classWarnssetGlobalStream method of RandStream classReplace all existing instances of RandStream.setDefaultStream with RandStream.setGlobalStream.
getDefaultStream method of RandStream classWarnsgetGlobalStream method of RandStream classReplace all existing instances of RandStream.getDefaultStream with RandStream.getGlobalStream.
atan2(y,x) for complex y and x.Errorsatan2(real(y),real(x)) when y and x are complex.Replace all existing instances of atan2(y,x) with atan2(real(y),real(x)) where y and x are complex.
Second output argument for besselh, besseli, besselj, besselk, bessely, and airy. For example, [J,ierr] = besselj(nu,Z).WarnsSyntax that returns only the solution vector. For example, J = besselj(nu,Z).Replace all instances that return two output arguments with the syntax that returns only the solution vector.
Passing mixed orientation input vectors to besselh, besseli, besselj, besselk, and bessely. For example, passing a row vector followed by a column vector:
`J= besselj(rowNu, colZ)`
or passing a column vector followed by a row vector:
`J= besselj(colNu, rowZ)`
Warns

Construct the inputs with ndgrid or meshgrid first. Alternatively, you can pass a function handle and the mixed orientation vectors to bsxfun.

Modify all instances that pass mixed orientation vectors. You can modify your code in one of two ways:
• Call meshgrid or ndgrid to construct the full grid first.

```[nu,Z]= meshgrid(rowNu, ColZ);
J= besselj(nu, Z);```
• Pass a function handle and the mixed orientation vectors to bsxfun. For example, if your existing code passes a row vector followed by a column vector, make the following change:

J= bsxfun(@besselj, rowNu, colZ);or, if your code passes a column vector followed by a row vector, make the following change:

J= bsxfun(@besselj, colNu', rowZ.');

Y = psi(k0:k1,X)WarnsY = psi(k,X) where k is a scalar specifying the kth derivative of ψ at the elements of X.Replace all instances of Y = psi(k0:k1,X) with Y = psi(k,X), where k is a scalar. To modify your code, loop through the values k0:k1. For example:
```for k=k0:k1
Y(:,k) = psi(k,X);
end```
In the future, size(Y) will be size(X). Modify any code that depends on size(Y).
Passing empty and nonscalar input to besselh, besseli, besselj, besselk, bessely, and airy. For example,
`J = besselj([],(1:3))`
or
`J = besselj((1:3),[])`
WarnsJ = besselj(nu,[]) or J = besselj([],Z) where nu and Z are scalars.Modify all instances that pass combinations of empty arrays with nonscalar input. The inputs must be the same size or one must be a scalar.

### Programming

#### xlsread Reads XLSX Files on All Platforms

The xlsread function now reads data from XLSX files on all platforms, including support for specifying the range and worksheet number. Previously, this functionality was available only on Microsoft Windows systems with Excel software.

#### VideoWriter Supports MPEG-4 Files on Windows 7 Systems

VideoWriter now creates MPEG-4 files with the extension .mp4 or .m4v on Windows 7 systems. For more information, see the VideoWriter reference page.

#### audioplayer Supports Overlapping Playback

In R2011a, changes that allowed audioplayer to support device selection also disabled the ability to play overlapping audio samples. With R2012a, overlapping playback is available again.

For example, play a second sample before the first one completes, and hear audio from both:

```chirpData = load('chirp.mat');
chirpObj = audioplayer(chirpData.y,chirpData.Fs);

gongObj = audioplayer(gongData.y,gongData.Fs);

play(chirpObj);
play(gongObj);```

#### importdata Returns Different Output for Some Text Files

Previously, the importdata function recognized comments in text files and did not include them in the output. In addition, importdata parsed files that contained numeric values and comma, space, or tab delimiters into a numeric array, even when you specified a delimiter that did not match the contents of the file.

In this release, importdata honors the specified delimiter, and includes comments in the output. For example, consider a hypothetical file named test.txt with this space-delimited data:

```% Comment in file
1 2 3
4 5 6```

In previous releases,

`t = importdata('test.txt',',')`

returned a numeric array:

```t =
1     2     3
4     5     6```

In this release, the same code returns a cell array:

```t =
'% Comment in file'
'1 2 3'
'4 5 6'
```

If you remove the incorrect comma delimiter,

`t = importdata('test.txt')`

importdata returns a struct array:

```t =
data: [2x3 double]
textdata: {'% Comment in file'}```

#### Exponents Print with Two Digits

In previous releases, functions that printed floating-point values with exponents used three digits for the exponent on Windows systems, but two digits on any other system. Now, these functions use two digits for the exponent on all systems.

For example,

`str = sprintf('%e',pi)`

always returns

```str =
3.141593e+00```

#### Conversion of Error and Warning Message Identifiers

For R2012a, error and warning message identifiers have changed in MATLAB.

#### Compatibility Considerations

If you have scripts or functions that use message identifiers that changed, you must update the code to use the new identifiers. Typically, message identifiers are used to turn off specific warning messages, or in code that uses a try/catch statement and performs an action based on a specific error identifier.

For example, the MATLAB:eigs:NonPosIntSize identifier has changed to MATLAB:eigs:RoundNonIntSize. If your code checks for MATLAB:eigs:NonPosIntSize, you must update it to check for MATLAB:eigs:RoundNonIntSize instead. For a mapping of the new identifiers to the original identifiers, see Technical Support solution 1-ERAFNC.

#### Specify a List of Allowed Subclasses in the Class Definition

You can control which classes are allowed to subclass a class that you define by specifying a list classes in the new class attribute, AllowedSubclasses. See Controlling Allowed Subclasses for more information.

#### Specify Which Classes Can Access Class Members

You can control access to specific class members (properties, methods, and events) by specifying a list of classes to which you want to grant access to these members. See Controlling Access to Class Members for more information.

#### Compatibility Considerations

In previous releases, you could assign a value to the following class member access attributes as a value returned by a function:

• Properties – Access, GetAccess, and SetAccess

• Methods – Access

• Events – ListenAccess and NotifyAccess

With this release, you can specify values for these attributes only explicitly as either the appropriate character string or a meta.class object returned by the ? operator, or a cell array of character strings and/or meta.class objects. See Specify Access to Class Members for more information.

#### Method Declared as Abstract and Private Now Errors

In previously releases, declaring a method as both Abstract and Access = private did not cause an error. With this release, declaring a method both Abstract and private causes an error.

#### Compatibility Considerations

If any of your class definitions declare a method as both Abstract and private, you need to declare the method either as Abstract, which make the class abstract and requires subclasses to implement the method with the declared syntax, or declare the method Access = private, which means that only methods within the defining class can call the private method.

Declaring a method as both Abstract and private is not supported.

#### New Capabilities for Writing Image Data to FITS Files

MATLAB now includes a function named fitswrite that you can use to write image data to Flexible Image Transport System (FITS) files. You can also display the metadata for all Header-Data Units (HDUs) in a FITS file using the fitsdisp function. (MATLAB already supports reading FITS files using the fitsread function.)

In addition, MATLAB now includes a new package, called matlab.io.fits, containing dozens of functions that provide access to the routines in the CFITSIO library. Using these low-level functions, you can create FITS files, read data from FITS files and write data to the files, using the CFITSIO library, version 3.27.

#### Access Data on Remote Servers Using the OPeNDAP Protocol

You can read data stored on remote servers using the OPeNDAP protocol capability of the following MATLAB NetCDF functions:

To use these functions to access data on remote servers using OPeNDAP protocol, specify the URL instead of a file name.

#### Upgrades to Scientific File Format Libraries

The following table lists upgrades to scientific file format libraries used by MATLAB.

LibraryVersion
NetCDF4.1.3 (upgraded from 4.1.2)

#### Ability to Read NetCDF Files Using HDF4 Functions Removed

In past releases, for certain NetCDF files on Linux and Macintosh systems, you could read the files using the HDF4 functions. This capability has been removed. To read NetCDF files, use the high-level NetCDF functions or the low-level NetCDF package.

#### Functionality Being Removed or Changed

FunctionalityWhat Happens When You Use This Functionality?Use This InsteadCompatibility Considerations
avifileStill runsVideoWriterReplace all instances of avifile with VideoWriter.
fileparts return argument 4 (file version)Errors — beginning in MATLAB Version 7.13 (R2011b)No alternative; file versions are unsupportedCall fileparts with three return arguments: [path_name, file_name, file_extension]
helpbrowserStill runsdocReplace all instances of helpbrowser with doc.
helpdeskStill runsdocReplace all instances of helpdesk with doc.
helpwinStill runsdocReplace all instances of helpwin with doc.
infoWarns Remove all instances of info. Find information about MathWorks at www.mathworks.com/company/aboutus/contact_us.
mmreader.isPlatformSupported and VideoReader.isPlatformSupportedErrors For a platform-specific list of supported video file formats, use getFileFormats.
supportWarns Remove all instances of support. Find the MathWorks technical support page at www.mathworks.com/support.
whatsnewWarns Remove all instances of whatsnew.

### New Compiler Support

MATLAB Version 7.14 (R2012a) supports these new compilers for building MEX-files on Linux 64- and 32-bit platforms:

• GNU gcc Version 4.4.6

MATLAB supports these new compilers for building MEX-files on Windows 64- and 32-bit platforms:

• Intel Visual Fortran Composer XE 2011 SP1 (12.1)

### Discontinued Compiler Support

MATLAB no longer supports the following compilers:

#### Windows 64-Bit Platforms

• Microsoft Visual Studio® 2010 (10.0) Express

#### Windows 32-Bit Platforms

• Microsoft Visual Studio 2010 (10.0) Express

• Visual C++ 6.0

#### Linux (64- and 32-Bit) Platforms

• GNU gcc Version 4.3.x

#### Compatibility Considerations

To ensure continued support for building your MEX-files, consider upgrading to another supported compiler. For an up-to-date list of supported compilers, see the Supported and Compatible Compilers Web page.

#### mxAssert and mxAssertS Functions Throw MATLAB Exception

The mxAssert and mxAssertS functions now throw the MATLAB exception MATLAB:mex:assertion and terminate the MEX-file instead of aborting MATLAB.

#### Version Support for COM ProgID Values

You can specify version-specific Programmatic Identifiers (ProgID) for MATLAB Version 7.14 (R2012a) and later.

• MATLAB.Desktop.Application

• MATLAB.Application

• MATLAB.Application.Single, to specify a dedicated server.

## R2011b

New Features, Bug Fixes, Compatibility Considerations

### Error Messages Reformatted for Improved Readability and Navigation

Error messages in the Command Window no longer appear with question marks or arrows. In addition, error messages for each function now provide a link to that function's documentation.

The following images show examples of the differences in presentation:

• Built-in functions:

• MATLAB Version 7.13 (R2011b)

• MATLAB Version 7.12 (R2011a) and earlier

• Functions that are not built in:

• MATLAB Version 7.13 (R2011b)

• MATLAB Version 7.12 (R2011a) and earlier

#### Editor

New Desktop features and changes introduced in this version are:

### Automatically Renaming All Variables and Functions in File

Under certain conditions, as you rename a variable or function, a tooltip opens. The tooltip indicates that MATLAB can rename all instances of the function or variable in the current file. This is helpful in preventing errors that result if you change names manually and overlook or mistype one or more instances of the name. For a video overview, watch this video demovideo demo

For details, including the circumstances under which MATLAB prompts you, see Automatically Rename All Functions or Variables in a File.

### Displaying Multilingual Characters on Mac OS X Platforms

On Apple Mac OS X platforms, you might see garbled text if you try to use multilingual characters. Suppose you create a variable in the MATLAB command window containing multilingual characters. You can type the multilingual characters, but if you display the contents of the variable, the characters are corrupted.

MATLAB text files include scripts and user-defined functions and classes. MATLAB displays characters in a text file using an encoding scheme, which is defined in the MathWorks locale database. This encoding scheme supports characters for the language specified by the user locale setting. If you try to use multilingual characters in a text file, you may have to use a different encoding scheme. UTF-8 is often used to handle multilingual characters. In R2011b, to handle multilingual characters, you can change the default encoding scheme to UTF-8 by switching the MathWorks locale database. Note that changing the default encoding scheme might cause characters other than 7-bit ASCII characters in existing text files to be garbled.

See How the MATLAB Process Uses Locale Settings for more information.

#### How to Change MATLAB's Default Encoding to UTF-8

You can change the default encoding scheme on Mac OS X platforms by using the UTF-8 locale database found in the matlabroot/bin folder. If you have text files containing characters other than 7-bit ASCII characters, you must convert the encoding before changing the default encoding. For instructions, see How to Convert Text File Encoding to UTF-8.

To change the default locale database, type:

```mldir = fullfile(matlabroot,'bin');
copyfile(fullfile(mldir,'lcdata.xml'),...
fullfile(mldir,'lcdata_default.xml'));
copyfile(fullfile(mldir,'lcdata_utf8.xml'),...
fullfile(mldir,'lcdata.xml'));
```

#### How to Convert Text File Encoding to UTF-8

Before converting a file, copy the file to a new directory.

Use the Mac OS X TextEdit application to convert the file encoding. For example:

1. Open a MATLAB text file with TextEdit.

2. Select File ->Save as...

3. Change the file name.

4. Change Plain Text Encoding: to Unicode (UTF-8).

5. Save the file.

Alternatively, the following MATLAB code creates a new text file with the encoding set to UTF-8:

```function convertencoding(infile, outfile)

fpIn = fopen(infile, 'r', 'n');
fpOut = fopen(outfile, 'w', 'n', 'UTF-8');

while feof(fpIn) == 0
lineIn = fgets(fpIn);
fwrite(fpOut, lineIn, 'char');
end

fclose(fpIn);
fclose(fpOut);
end```

#### Compatibility Considerations

In a future release, the UTF-8 version of the MathWorks locale database will be the default on Mac OS X systems. Any text file created in MATLAB that is encoded in the user default encoding and contains characters other than 7-bit ASCII characters must be converted to the UTF-8 encoding scheme. Otherwise, MATLAB and other MathWorks products might not be able to properly load the files.

You must convert the file encoding before changing the default locale database.

### Mathematics

#### New Functionality for Grid-Based Interpolation

MATLAB includes a new class, griddedInterpolant, for grid-based interpolation. griddedInterpolant works with grids in ndgrid format and complements the functionality provided by interpn to provide improved performance and memory efficiency.

#### Performance Enhancements

The following functions show improved performance:

• Some integer math functions

• Some linear algebra functions, including chol and 3-output form of qr

• Trigonometric functions

#### Permutation Option for randperm

The randperm function and the RandStream.randperm method now have the option of returning random permutations of k integers selected at random from the integers 1 through n.

#### Return Permutation Information in Vector for qr

If you use the three-output form of qr in noneconomy mode, you can now specify 'vector' as an input argument. The permutation information will return a vector instead of a matrix.

#### Changes to meshgrid and ndgrid

The functions meshgrid and ndgrid have changed behavior under certain calling scenarios:

• When more than one input argument is passed to meshgrid, the dimensionality of the output arrays is deduced from the number of inputs.  Previously the dimensionality was deduced from the number of outputs.  For example, [x,y] = meshgrid(1:3,1:4,1:5) will now assume a missing third output argument and return 3-D output arrays x and y. Previously, the third input was ignored and the function returned 2-D arrays for x and y.

• When a single argument is passed to ndgrid, the dimensionality of the output arrays is dictated by the number of output arguments. ndgrid has been revised to maintain consistency in the case of a single input and output. ndgrid will now degenerate naturally to support 1-D outputs. For example, x = ndgrid(1:5) returns a 5-by-1 output vector x. Previously, a 5-by-5 array was returned.

#### Functionality Being Removed or Changed

FunctionalityWhat Happens When You Use This FunctionalityUse This InsteadCompatibility Considerations
besselErrorsbesseljReplace all instances of bessel with besselj.
ODE solver syntax
solver('vdp',t0,tfinal,y0)
where solver is one of the ODE solvers ode45, ode23, ode113, ode15s, ode23s, ode23t, or ode23tb
or
solver(@vdp,[t0 tfinal],y0)
Replace all instances of the syntax t0,tfinal with [t0 tfinal].
Values on and off for Mass property of odeset and odegetErrorsSet the Mass property to a constant matrix or a function that evaluates the variable mass matrix.Update your code to use a constant mass matrix or a function that evaluates the variable mass matrix. For more information, check the supported settings of Mass and MassStateDependency in the odeset properties.
MassConstant property of odeset and odegetErrorsFor a constant mass matrix, set the Mass property to that matrix. For a time-dependent mass matrix, set the Mass property to a function that evaluates the matrix and set the MassStateDependency property to none.Update your code to use a constant mass matrix or a function that evaluates the variable mass matrix. For more information, check the supported settings of Mass and MassStateDependency in the odeset properties.

### Programming

#### Load and Save Parts of Variables in V7.3 MAT-Files

The new matfile function creates a matlab.io.MatFile object that can efficiently load or save to parts of variables in Version 7.3 MAT-Files. Loading part of a variable requires less memory than loading the entire contents of that variable.

For example, these commands create a MAT-file and add data to part of variable X:

```new = matfile('newfile.mat','Writable',true);
new.X(6:10,6:10) = magic(5); ```

This command loads part of the data into variable partOfX:

`partOfX = new.X(1:8,1:8);`
 Note:   Syntax such as size(new.X) or new.X(end,end) temporarily loads the entire contents of variable X into memory. To determine the size of a variable without loading, use the size method for matlab.io.MatFile objects:```sizeOfX = size(new,'X'); ```

For more information, see the matfile reference page or watch this video demovideo demo.

#### Nonmatching Function Name Warning is Now an Error

In previous releases of MATLAB, entering a function name that did not match any known function name in the given letter case resulted in a warning. After displaying this warning message, MATLAB attempted find a function that would match if letter case were ignored. If such a match were found, MATLAB ran this function instead.

In MATLAB R2011b, the MATLAB software generates an error if it can't find an exact-case match. The message displayed by the error may suggest the correct spelling for the function that was entered. The message identifier for this error reads as follows:

`'MATLAB:dispatcher:InexactCaseMatch'`

#### Compatibility Considerations

If you have a program that calls another program with nonmatching letter case, the call to this function now throws an error.

#### New narginchk Function Replaces nargchk

narginchk is a new function that replaces and adds to the functionality of nargchk.

The narginchk function differs from nargchk in the following ways:

• narginchk accepts only 2 inputs: the minimum and maximum allowable number of arguments one can pass to the currently running function.

• narginchk returns no outputs. Instead, it throws an error if the number of arguments passed to the current function is outside the allowable range

#### Conversion of Error and Warning Message Identifiers

For R2011b, error and warning message identifiers have changed in MATLAB.

#### Compatibility Considerations

If you have code that uses message identifiers that changed, you must update the code to use the new identifiers. Typically, message identifiers are used to turn off specific warning messages, or in code that uses a try/catch statement and performs an action based on a specific error identifier.

For example, the MATLAB:eigs:NonPosIntSize identifier has changed to MATLAB:eigs:RoundNonIntSize. If your code checks for MATLAB:eigs:NonPosIntSize, you must update it to check for MATLAB:eigs:RoundNonIntSize instead. For a mapping of the new identifiers to the original identifiers, see Technical Support solution 1-ERAFNC.

#### New Spreadsheet Import Tool

The new Spreadsheet Import Tool allows you to select ranges of data and define rules for handling nonnumeric values. This tool opens instead of the Import Wizard for spreadsheets and comma-separated value (CSV) files. For more information, watch this video demovideo demo.

#### Two Functions Added to netCDF Low-Level Package To Aid Performance

The NetCDF low-level package now includes two functions that you can use to improve performance:

• netcdf.getChunkCache – Return default chunk cache settings.

• netcdf.setChunkCache – Set the default chunk cache settings.

#### Improved Performance for TIFF Input and Output

Input and output performance for TIFF files has been improved, when using imread and imwrite.

#### Upgrades to Scientific File Format Libraries

The following table lists upgrades to scientific file format libraries used by MATLAB.

NetCDF4.0.1 to 4.1.2
HDF51.8.3 to 1.8.6
HDF44.2r4 to 4.2.5
HDF-EOS2.16 to 2.17
TIFF3.7.1 to 3.9.5

#### VideoReader Supports MPEG-4 and MOV on Windows 7 Systems

VideoReader now imports MPEG-4 and Apple QuickTime movies, and any other formats supported by Microsoft Media Foundation, on Windows 7 systems. For more information, see the VideoReader reference page.

#### MATLAB Warns if Listener Defined for Nonobservable Property

If you attempt to create a PreSet or PostSet listener for a property that is not declared as SetObservable, MATLAB issues a MATLAB:class:nonSetObservableProp warning.

If you attempt to create a PreGet or PostGet listener for a property that is not declared as GetObservable, MATLAB issues a MATLAB:class:nonGetObservableProp warning.

In previous releases, MATLAB did not warn in either case, but did not call the listener callback function when a set or get event occurred. In a future release, these warnings will become errors.

#### Compatibility Considerations

If you use class metadata or the properties function to get a list of properties for which you create listeners, add warning/error handling for these conditions. A better approach is to use findobj to get the list of observable properties for any given class and assign listeners only for those properties.

#### MATLAB Warns if Property Is Not Member of Class When Defining Listener

When calling the event.proplistener constructor, or calling the addlistener method with an array of meta.property objects, warning messages alert you if a property is not a member of the correct class.

• Nonscalar input objects: if any one of the properties is not a valid member of the class of the object array, MATLAB issues the MATLAB:class:PropNotMember warning .

• Scalar input object: if any of the properties are not valid dynamic or class properties, MATLAB issues the MATLAB:class:DynPropNotMember or MATLAB:class:PropNotMember warning.

In previous releases, MATLAB did not warn in either case. In a future release, these warnings will become errors.

#### Built-In disp Works with Empty Objects

It is now possible to call the built-in disp function with empty objects. For example, define the TestClass as:

```classdef TestClass
properties
PropertyA = 1;
end
end```

Then call the built-in version of disp:

```>> builtin('disp',TestClass.empty)
0x0 empty TestClass

Properties:
PropertyA

Methods```

In previous releases, calling the built-in disp function did not display anything with empty objects.

#### MATLAB Warns if Class Defines Property as Dependent and Constant

MATLAB now issues a warning if a class defines properties as both Dependent and Constant. In a future release, this warning will become an error.

#### Support for Switch/Case Statements with Objects

You can construct switch statement blocks using objects as both the switch expression and the case expression. The object's class must define or inherit an eq (==) method. See Using Switch/Case Statements with Objects in Functions Used with Objects for more information.

#### Functionality Being Removed or Changed

FunctionalityWhat Happens When You Use This Functionality?Use This InsteadCompatibility Considerations
nargchkStill runsnarginchkAccepts only min and max inputs, returns no output, generates error.
nargoutchkStill runsnargoutchk (see new syntax)Accepts only min and max inputs, returns no output, generates error.

### New Compiler Support

MATLAB Version 7.13 (R2011b) supports these new compilers for building MEX-files on Windows 64- and 32-bit platforms:

• Microsoft Windows Software Development Kit for Windows 7 and .NET Framework 4, Version 7.1

• Intel C++ Composer XE 2011

• Intel Visual Fortran Composer XE 2011

MATLAB Version 7.13 (R2011b) supports the following new compiler for building MEX-files on Mac OS X 64-bit platforms:

• Apple Xcode 4.0.0 with gcc 4.2.x

### Compiler Support To Be Phased Out

Support for the following compilers on Windows 64- and 32-bit platforms will be discontinued in a future release, at which time new versions will be supported. For an up-to-date list of supported compilers, see the Supported and Compatible Compilers Web page.

• Intel C++ Version 11.1

• Intel Fortran Version 11.1

#### New Object Support for mxGetProperty and mxSetProperty Functions

You can read and modify properties of Java and COM objects using the mxGetProperty and mxSetProperty functions.

#### MEX Header File Does Not Define C++ Type char16_t

The matrix.h header file, used by the mex.h header file for building C/C++ MEX-files, no longer defines the C++ type char16_t.

#### Compatibility Considerations

If your MEX-file uses the char16_t type, you must include the appropriate header file for your compiler in order to build the MEX-file. For example, the header file for Microsoft Visual Studio Version 10.0 is yvals.h.

### Support for Cell Arrays

#### Creating Cell Arrays from .NET Stings and Objects

Use the MATLAB cell function to convert .NET System.String and System.Object arrays to MATLAB cell arrays. For more information, see Converting .NET Arrays to Cell Arrays.

#### Passing Cell Arrays to .NET Methods

If an input argument to a .NET property or method is an array of System.Object or System.String, you can pass a cell array. MATLAB automatically converts a cell array into the appropriate .NET array. For more information, see Pass Cell Arrays.

### Support for Auto-Conversion of Multidimensional Arrays

You can pass MATLAB arrays directly to .NET without explicitly converting them into .NET arrays. MATLAB also converts an array of a lower dimensionality to a higher dimensionality .NET array. For more information, see Pass Arrays.

#### Compatibility Considerations

In most cases, you no longer need to use the NET.convertArray function. Review your MATLAB code to update the use of this function. If you continue to use NET.convertArray, note the following change of behavior for empty matrices:

• If you call NET.convertArray with an N-D empty matrix and try to convert it to 1-D .NET array, MATLAB throws the following error:

`Source and destination array dimension sizes do not match.`
• Different results for:

`NET.convertArray(rand(0,1,1))`

As of R2011a, MATLAB creates a System.Double[,]. In R2011b, MATLAB creates a System.Double[].

#### COM Automation Server Error Message Formatting

Although some MATLAB Command Window messages have been reformatted (see Error Messages Reformatted for Improved Readability and Navigation), error messages from the Execute function can still be identified with leading ??? characters.

## R2011a

New Features, Bug Fixes, Compatibility Considerations

### Desktop Tools and Development Environment

#### Desktop

New features and changes introduced in Version 7.12 (R2011a) are:

### MATLAB Menus Display at the Top of the Apple Mac Screen

Previously when running on Apple Mac, menus displayed at the top of the MATLAB desktop. In addition, if a tool was undocked from the desktop, the menu displayed at the top of that tool. Now, to be consistent with the behavior of most Mac applications, MATLAB menus display at the top of the Mac screen.

### New Location and Archived Content for Product Documentation

The new MathWorks Web site location for product documentation is http://www.mathworks.com/help/. Accessing the old URL, http://www.mathworks.com/access/helpdesk/help/helpdesk.html, redirects you the new location.

In addition to all current product documentation, the new location provides archived product documentation from all releases going back to R13sp2 (including Japanese, when available). To go to the archive, click the View documentation for other releases link. The archived release documentation is available only at the MathWorks Web site, and not via the Help browser.

To view some documentation you must log on to www.mathworks.com with your MathWorks user name and password. For example, you need to log in to view current PDF files and documentation from prior releases.

The View > Page Location dialog box in the Help browser now links to documentation at the MathWorks Web site that accompanies the release you are currently running. For example, when you run R2011a, the dialog box looks like this.

As of R2011a, the Help Browser View > Page Location dialog box (shown above) is available on Japanese language systems.

### Submit Support Requests Directly from MATLAB

As of this release, if you need assistance from MathWorks product support, you can request it directly from the MATLAB desktop. Selecting the Submit a MathWorks Support Request option from the Help menu opens a login dialog for you to provide the e-mail address and password for your MathWorks account. After you log in, a form displays for you to create a service request. Select the product for which you want help, explain the issue you are having, give the request a meaningful title, describe the issue you are having, provide reproduction steps, and attach files that enable Technical Support to follow the steps.

If you do not have a MathWorks account, the login form enables you to create one. MathWorks accounts are free and without obligation. You can also use the account login form to obtain a forgotten MathWorks password. You can log out before submitting your request or remain logged in.

For an example of submitting a support request, see this video demovideo demo. For further details about requesting service requests from MATLAB, see Contact Technical Support.

#### Managing Files

New features and changes introduced in Version 7.11 (R2011a) are:

### Renaming Files and Folders in the Current Folder Browser Now Reflected in the Editor

If a file is open in the Editor and you:

• Rename that file in the Current Folder browser, then the file name updates in the Editor

• Rename the folder containing that file in the Current Folder Browser, then MATLAB updates the file specification for all open Editor documents in the renamed folder

• Delete that file from the Current Folder browser, then MATLAB deletes the file from disk and renames the Editor document to Untitled*

If more than one unnamed document is open in the Editor, then MATLAB renames the deleted document Untitledn*, where n is an integer.

However, modifying file and folder names from either of the following does not update names for open documents in the Editor:

• The operating system file manager — such as Windows Explorer

• The MATLAB Command window — using movefile, for instance

### Options Names Changed for Locating and Opening Files and Folders Outside the MATLAB Desktop

To locate a file or folder in Windows Explorer or Apple Mac Finder, you previously used the Current Folder browser context-menu option, Locate on Disk. Now the option is one of the following:

• On Microsoft Windows systems—Show in Explorer

• On Macintosh systems—Show in Finder

In addition, from the Current Folder browser, you can open the current folder in Explorer or Finder. Right-click in white space, and then select Open Current Folder in Explorer or Open Current Folder in Finder.

### Comparison and Merging of MAT-file Variables

When comparing MAT-files, you now can view details of differences between variables to see which fields of a structure are different and to view differences in individual elements of an array. You can merge changes between files by copying variables from one file to another. For details, see Comparing MAT-Files.

### Filter Results in Folder Comparisons

You now can define filters to exclude unimportant differences when comparing folders. For example, you can exclude backup files or files created by a revision control system. Filters can save time when reviewing differences, especially when comparing many subfolders. For details, see Comparing Folders and Zip Files.

### Showing Differences Only in Text Comparisons

When comparing text files, you now can specify whether to show only differences. Use the new toolbar button in the Comparison Tool to hide sections of the report that do not include any differences. It can be useful to hide unmodified lines in large text comparison reports. For details, see Comparing Text Files.

#### Editing and Debugging MATLAB Code

New Desktop features and changes introduced in Version 7.11 (R2011a) are:

### Change to Tooltip and Behavior for M-Lint Messages

Previously, when you hovered the mouse pointer over code in the Editor that has an autofixable M-Lint warning message, a tooltip opened that included the phrase, Press Alt + Enter to fix, as shown in this image.

Now, this phrase is removed from the M-Lint tooltip. You can still use the keyboard shortcut, Alt+Enter, to apply the autofix, but your cursor must be within the code to which the autofix will be applied.

#### Compatibility Considerations

When an M-Lint tooltip is open and you want to apply the autofix for that warning, click the Fix button. To apply the same autofix using a keyboard shortcut, move the cursor within the code that generates the warning, and then click Alt+Enter.

### Changed Default Preference for Deleting Autosaved Files

Previously, the Automatically delete autosave files preference for the Editor was disabled by default. Now, it is enabled by default. However, as usual, MATLAB retains settings you set explicitly in a previous release (unless you delete matlab.prf. )

For more information, see Autosaving Files and Where MATLAB Stores Preferences.

### Shared Scope Color Preferences Apply to Persistent and Global Variables

Previously, the preference for Variables with shared scope was labeled Nonlocal variables and it affected the color of variables within nested functions only. Now, the Editor also applies this color preference to variables you declare as global or persistent.

This feature makes it easier to find reuses of a variable, which sometimes indicate variable scoping problems. For details, including information on how to disable or change the colors that the Editor uses for variables with shared scope, see Avoid Variable and Function Scoping Problems.

#### Publishing MATLAB Code

New Desktop features and changes introduced in Version 7.11 (R2011a) are:

### Change to Menu Option for Including Blocks of LaTeX Code

Previously, if you wanted to include blocks of LaTeX code within your MATLAB code intended for publishing, you selected Cell > Insert Text Markup > LaTeX Equation. Now you select Cell > Insert Text Markup > LaTeX Display Math. The name of the option was changed to better distinguish it from a new publishing option that enables you to include inline LaTeX equations in your published code.

For details see LaTeX Display Math.

### Menu Option to Include Inline LaTeX Math in Published MATLAB Code

The Cell menu now provides an option for including inline LaTeX equations. Position the cursor within the comment line where you want the LaTeX equation to appear, and then select Cell > Insert Text Markup > LaTeX Inline Math.

For details see Inline LaTeX Math Equations.

#### MATLAB Notebook Menu Labels

Menu labels for MATLAB Notebook are changed. To ensure your menu options are up to date, and match those presented in the documentation, run the following command:

`notebook -setup`

MathWorks recommends you run this command whenever you install a new version of MATLAB.

### Mathematics

#### New Function rng

The new rng function controls the random number generator used by rand, randi, and randn. For a demonstration, see this instructional videovideo.

rng is the recommended alternative to former rand and randn input syntaxes 'seed', 'state' and 'twister'. rng is a simpler alternative to the RandStream class. To use rng, see the documentation on Updating Your Random Number Generator Syntax.

#### New Function ichol

The new ichol function performs incomplete Cholesky factorization and is the recommended alternative to cholinc.

#### New Option for gammainc

The new options gammainc(X,A,'scaledlower') and gammainc(X,A,'scaledupper') now return scaled versions of the incomplete gamma function gammainc.

#### Performance Enhancement

• Matrix transpose

• Element-wise single precision functions

• Sparse matrix indexed assignment

• Many linear algebra functions

• Convolution for long vectors and large matrices with conv and conv2

#### Changes to qr

In R2010a and R2010b, the upper triangular output R from the full qr function was guaranteed to have real and nonnegative diagonal elements. In this release, the behavior reverts to that of R2009b and prior releases. That is, the diagonal of R may contain complex and negative elements, and will affect the unitary output Q correspondingly.

#### Compatibility Considerations

Since the QR factorization is not unique, these different results are still correct. Ensure that your code does not depend on the values of the elements of the factors Q and R.

#### Functionality Being Removed

Function NameWhat Happens When You Use This FunctionUse This Function InsteadCompatibility Considerations
besselErrorsbesseljReplace all instances of bessel with besselj.
intwarningErrorsNoneRemove all instances of intwarning from your code.
luincWarnsiluReplace instances of luinc with ilu.
cholinc(X,'inf')WarnsNoneRemove all instances of cholinc(X,'inf') from your code.
All other syntaxes of cholinc except cholinc(X,'inf')WarnsicholReplace these instances of cholinc with ichol.
RandnAlg property of RandStream classStill runsNormalTransform property of RandStream classReplace all existing instances of RandnAlg with NormalTransform.
setDefaultStream method of RandStream classStill runssetGlobalStream method of RandStream classReplace all existing instances of RandStream.setDefaultStream with RandStream.setGlobalStream.
getDefaultStream method of RandStream classStill runsgetGlobalStream method of RandStream classReplace all existing instances of RandStream.getDefaultStream with RandStream.getGlobalStream.
rand or randn with the 'seed', 'state' or 'twister' inputsStill runsrngSee Updating Your Random Number Generator Syntax in the MATLAB Mathematics documentation.

### Programming

#### Regenerate P-code Files Built Before Version 7.5

To enable the MATLAB software to take advantage of significant performance improvements planned for a future release, MathWorks recommends that you begin to regenerate any P-code files you use that were generated prior to MATLAB 7.5 (release R2007b). P-code files generated in releases earlier than R2007b will not run in this future release with the new performance features enabled.

#### Compatibility Considerations

Using MATLAB 7.5 or later, rebuild any P-code files that you expect to need in the future.

#### VideoWriter Supports Motion JPEG 2000 Files

VideoWriter now creates Motion JPEG 2000 (.mj2) files, which support logging data with these features:

• Multi-byte precision, such as 10, 12, or 16 bits

• Signed data values

• Lossless compression

For more information, see the VideoWriter reference page.

#### audioplayer and audiorecorder Support Device Selection on All Platforms

audioplayer and audiorecorder now allow you to specify the input or output device on all supported platforms. In previous releases, you could only specify devices on Microsoft Windows systems.

#### Compatibility Considerations

• audioplayer, audiorecorder, and audiodevinfo now use different technology for enumerating system input and output devices. If your existing code specifies a device ID (other than the default, -1), check whether you need to change the ID. To determine your device IDs, call audiodevinfo.

• audioplayer does not support overlapping playback. For example, in this code, the second call to play returns an error:

```chirpData = load('chirp.mat');
chirpObj = audioplayer(chirpData.y, chirpData.Fs);

gongObj = audioplayer(gongData.y, gongData.Fs);

play(chirpObj);
play(gongObj);```

#### New Class Forms the Basis for Heterogeneous Hierarchies

The matlab.mixin.Heterogeneous class enables you to form heterogeneous arrays containing instances of classes derived from this class. You can create heterogeneous hierarchies of both handle and value classes.

#### New Class Provides the Basis for Customizable Handle Object Copy Method

The matlab.mixin.Copyable class enables you to define handle classes that inherit a copy method whose behavior you can modify in subclasses.

#### MATLAB Meta-Classes Can Now Form Heterogeneous Arrays

All MATLAB meta-classes are now defined in a heterogeneous hierarchy, which enables the formation of heterogeneous arrays of meta-class objects. This capability enables functions like findobj and findprop to return heterogeneous arrays containing instances of meta-classes of different specific types. The hidden class meta.MetaData forms the root of the heterogeneous hierarchy.

#### New High-Level NetCDF Functions

MATLAB now includes several new functions that provide a high-level interface to NetCDF files. These functions let you read and write to NetCDF files, without having to use the programming paradigm required by the low-level functions in the netCDF package. Using these functions, you can create a new NetCDF file based on the schema of an existing file, convert files between NetCDF formats, and create a new NetCDF file by merging together two existing NetCDF files.

• nccreate — Create variable in NetCDF file

• ncdisp — Display contents of netCDF file

• ncinfo — Return information about netCDF file

• ncread — Read data and attributes from netCDF file

• ncreadatt — Read global attribute or attribute associated with variable from netCDF file.

• ncwrite — Write data to netCDF file

• ncwriteatt — Write attribute to netCDF file

• ncwriteschema — Add netCDF schema definitions to a NetCDF file

#### New High-Level HDF5 Functions

MATLAB now includes several new high-level functions for working with HDF5 files. These functions let you read and write to HDF5 files, without having to use the programming paradigm required by the low-level functions in the HDF5 package.

• h5create — Create HDF5 data set

• h5disp — Display contents of HDF5 file

• h5info — Return information about HDF5 file

• h5read — Read data from HDF5 data set.

• h5readatt — Read attribute from HDF5 group or data set

• h5write — Write to HDF5 data set

• h5writeatt — Write HDF5 attribute to group or data set

#### Compatibility Considerations

The new high-level HDF5 functions have the following compatibility considerations with the existing high-level HDF5 functions.

#### Two New Functions Added to CDFLIB Package

The MATLAB interface to the CDF library now includes the following new functions.

• cdflib.setFileBackward — Sets the backward compatibility mode. If the backward mode is set to on, files created can be read by clients using version 2.7 of the library

• cdflib.getFileBackward — Return the current backward compatibility mode setting.

#### HDF4 Functions Grouped into Packages

The MATLAB HDF4 low-level functions and HDF EOS functions are now grouped into three new packages:

• matlab.io.hdf4.sd — access to more than 50 functions in the HDF library SD interface

• matlab.io.hdfeos.gd — access to more than 50 functions in the HDF-EOS library grid interface

• matlab.io.hdfeos.sw — access to more than 50 functions in the HDF-EOS library swath interface

For example, MATLAB previously included one function, hdfsd, that you used to call all the routines in the HDF library SD interface. Now, the new package matlab.io.hdf4.sd contains many individual functions that correspond to routines in the HDF SD Interface C library.

#### FITSREAD Function Now Supports Data Subsetting

The MATLAB fitsread function now supports data subsetting by using several new options: PixelRegion, TableColumns, and TableRows.

#### Unrecognized Name Warning Changed to Error

In earlier releases of MATLAB, a statement in which an unrecognized (e.g., misspelled) name immediately follows a function name and dot (.) results in a warning instead of an error. Here is the format this type of statement:

`functionname.unrecognizedname`

The following example shows such a statement case and part of the resulting warning:

```simulink.badname

Warning: Direct access of structure fields returned by a
function call (e.g., call to simulink) is not allowed.  ...```

In addition to being misleading, handling this case with merely a warning also allows the function (simulink, in this case) to execute, regardless of the fact that the name to the right of the dot is invalid.

In MATLAB version 7.12 (R2011a), this type of statement throws an error. The text of the error message is:

```simulink.badname

#### Compatibility Considerations

Any such statements in your code that have only generated a warning message in past releases will now throw an error. Any such error that is not caught and handled appropriately will terminate the function in which it occurs. MathWorks recommends that you replace the unrecognized name to the right of the dot with the correct name.

This change also affects the output of the lasterror function if you attempt to access any field value (message, identifier, or stack) directly. Earlier versions of MATLAB generate a warning:

```lasterror.message
Warning: Direct access of structure fields returned by a
function call (e.g., call to lasterror) is not allowed.  ...
```

This and future versions throw an error:

```lasterror.message
??? Undefined variable "lasterror" or function "lasterror.message".```

#### Regular Expressions Support Zero-Length Matching

Regular expressions in MATLAB now support successful zero-length matching. See the documentation on Empty Match mode in the description of Command Options for the regexp function.

#### Growing Arrays Is Faster

This release improves the performance of growing an array in the trailing dimension if that array has not been preallocated.

#### Error Checking Improved

MATLAB provides more effective error checking and returns new error messages in the following cases.

### Nonstatic Method

A reference to a class method using the class name is valid only in cases where the method is static. Therefore, code of the form:

`ClassName.ordinaryMethod`

Where ordinaryMethod is not a static method of the class ClassName, previously returned the error: MATLAB:class:InvalidStaticMethod.

This code now returns the error: MATLAB:subscripting:classHasNoPropertyOrMethod

### Nonexistent Method Name

A reference to a nonexistent method name:

`obj.badName`

Where badName is not a method defined by the class of obj, previously returned the error: MATLAB:noSuchMethodOrField.

This code now returns the error: MATLAB:subscripting:classHasNoPropertyOrMethod.

#### Compatibility Considerations

Code that checks for the specific errors previously returned must be updated to check for the new errors.

#### Functions and Function Elements Being Removed

Function or Function Element NameWhat Happens When You Use the Function or Element?Use This InsteadCompatibility Considerations
audioplayer(BufferLength)No effect (no-op) Remove all instances of BufferLength.
audioplayer(NumberOfBuffers)No effect (no-op) Remove all instances of NumberOfBuffers.
hdf5writeStill runsh5writeReplace with preferred function.
hdf5infoStill runsh5infoReplace with referred function.

### Graphics and 3-D Visualization

#### Plot Catalog with a New Look, More Plots, and Diagnostics

The Plot Catalog GUI now offers a wider variety of plotting options. Its appearance and operation closely resemble the Plot Selector, with short descriptions of each graph type and a search box. It also categorizes graphs by type and by toolbox, and lets you designate personal Favorites (the top menu category). Access the Plot Catalog from the Plotting Tools Figure Palette, the bottom of the Plot Selector menu in the Workspace Browser, the Variable Editor, and various context menus. For a demonstration, see this instructional videovideo.

This table lists the differences and similarities between the Plot Catalog and the Plot Selector.

Plot CatalogPlot SelectorBoth
Window CharacteristicsOpens in its own window, which persists until you close itOpens in a pop-up window that closes after it loses focusShow icons for plot types with descriptions and Favorites.
Help for Plot TypesDisplays partial help listings from reference pages in a resizeable pane within its windowOpens a popup help window with reference information when you hoverProvide the same help content and a More Help hyperlink to the Help Browser.
Plot Creation and ValidationProvides a field in which you can type variable names or expressions to plotPlots variables you select in the Workspace browser or Variable EditorValidate input variables and display diagnoses of incorrect or insufficient inputs.
Plot DestinationCurrent figure or new figureCurrent figureCreate figure, if none exists

Previously, the Plot Catalog did not validate input data. If you provided incorrect inputs for a plotting function, it attempted to use them, resulting in an incorrect plot or errors. Now, the Plot Catalog provides the same diagnostics as the Plot Selector. When you type workspace variable names into the Variables box on top, the tool validates variable types, sizes, and ordering. If validation fails, the Plot Selector provides a diagnostic message in its Help pane and does not let you run the plotting function.

In addition to MATLAB plots, the Plot Catalog offers the same set of choices as the Plot Selector. The choices include most types of plots from the following toolboxes (if installed):

• Control System Toolbox™

• Curve Fitting Toolbox™

• DSP System Toolbox™

• Financial Toolbox™

• Image Processing Toolbox™

• Mapping Toolbox™

• Signal Processing Toolbox™

• Statistics Toolbox™

• System Identification Toolbox™

For more information about the Plot Catalog, see Selecting a Graph from the Plot Catalog. For information on the Plot Selector, see Enhanced Plot Selector Simplifies Data Display.

### Creating Graphical User Interfaces (GUIs)

#### Do not Repopulate Menus on the Mac from Inside Their Callbacks

In R2011a, on the Mac platform only, uimenu callbacks are no longer able to replace all submenus during menu selection. Note that repopulating some (not all) menu items does not create this issue. However, it is not good programming practice to remove and insert menu items within a menu callback routine.

#### Compatibility Considerations

If you have a uimenu callback that repopulates all of its menu items when you open that menu, you must change that code if you want it to work on a Mac. For example, your code might be able to remove and install submenus from outside of the callback that handles the menu. The callback can also rename, disable, hide, and show submenus instead of deleting them and creating new ones. The Mac is the only platform impacted by this incompatibility. Menus on Microsoft Windows, Unix, and Linux continue to behave as they did in previous releases.

#### Functions and Function Elements Being Removed

Function or Function Element NameWhat Happens When You Use the Function or Element?Use This InsteadCompatibility Considerations
pagesetupdlgWarnsprintpreviewprintpreview provides all functionality and more, except for some unit choices. Update any GUIs that call pagesetupdlg to do page setup.

### New Compiler Support

MATLAB Version 7.12 (R2011a) supports these new compilers for building MEX-files:

#### Linux (64- and 32-Bit) Platforms

• GNU gfortran 4.3.x

#### Apple Mac 64-Bit Platforms

• Apple Xcode 3.2 with gcc 4.2.x

### Compiler Support To Be Phased Out

Support for the following compilers will be discontinued in a future release, at which time new versions will be supported. For an up-to-date list of supported compilers, see the Supported and Compatible Compilers Web page.

#### Microsoft Windows 32-Bit Platforms

• Microsoft Visual Studio 2005 SP1

• Visual C++ 6.0

#### Windows 64-Bit Platforms

• Microsoft Visual Studio 2005 SP1

### Discontinued Compiler Support

MATLAB no longer supports the following compilers:

#### Windows (64- and 32-Bit) Platforms

• Microsoft Visual Studio 2008 (9.0) Express

• Intel Visual Fortran Version 10.1

• GNU g95 0.90

#### Mac 64-Bit Platforms

• Xcode 3.1 with gcc 4.0.1

#### Compatibility Considerations

To ensure continued support for building your MEX-files, consider upgrading to another supported compiler. For an up-to-date list of supported compilers, see the Supported and Compatible Compilers Web page.

#### Changes to Shared Library Compiler Support

In MATLAB Version 7.12 (R2011a), you can use the loadlibrary command with any supported compiler. For an up-to-date list of supported compilers, see the Supported and Compatible Compilers Web page.

#### Compatibility Considerations

You must run mex -setup before using the loadlibrary command. For information about selecting a compiler, see Selecting a Compiler on Windows Platforms or Selecting a Compiler on UNIX Platforms.

### Support for .NET System.Enum Objects

MATLAB exposes .NET enumerations as native .NET classes:

• Support for non-Int32 underlying types

• Support for bit-wise bitand, bitnot, bitor, and bitxor operators

• Support for invocation of System.Enum methods, such as the HasFlag method in Framework Version 4.0

• Support for comparison and binary operators eq, ne, ge, gt, le, and lt on enumeration types

#### Compatibility Considerations

MATLAB displays an error when you use the enumeration command to return arrays of .NET enumeration objects. To read enumeration members into MATLAB arrays, see Refer to a .NET Enumeration Member.

MATLAB enumerations no longer inherit from the MATLAB int32 class.

You cannot create arrays of .NET enumeration objects. For example, if you type:

`a = [EnumTest.Colors.Red EnumTest.Colors.Blue]`

MATLAB displays:

`??? Array formation and indexing are not allowed on .NET objects.`

To combine members of an enumeration into a MATLAB variable, see Combining Enumerations into a Single MATLAB Variable.

### Support for Asynchronous .NET Delegate Callback Handling

You can use delegates to call a synchronous method asynchronously. See Calling a .NET Method Asynchronously.

Bug Fixes