Main Content

R2016b

New Features, Bug Fixes, Compatibility Considerations

Desktop

​Live Editor: Pan, zoom, and rotate axes in output figures​

Modify output figures interactively using the tools in the upper right corner of each axes. These tools appear when you select or hover over the axes. For more information, see Modify Output Figures.

Live Editor: Create and edit equations interactively using the equation editor​

You can build an equation interactively in live scripts by selecting from a graphical display of symbols and structures. To insert a new equation, go to the Live Editor tab and in the Insert section, click Equation. For more information, see Insert Equations into Live Scripts.

Live Editor: Create new sections and format text quickly using autoformatting​

For quick formatting in live scripts, you can use a combination of keyboard shortcuts and character sequences. For more information, including a list of supported sequences, see Autoformatting.

Live Editor: Automatically rename all functions or variables in a live script

Prevent typographical errors by automatically renaming multiple references to a function or variable within a live script. When you rename such a function or variable, a tooltip opens if there is more than one reference to that variable or function in the file. Press Shift + Enter to rename all instances of the function or variable.

Live Editor: Drag and drop selected code and text within a live script and between other applications

Drag selected code from a live script to and from another application, maintaining syntax highlighting and font characteristics.

Live Editor: View outputs sooner when running live scripts

The Live Editor now displays output in live scripts as it is created, instead of when the execution of a section is complete.

Command Window: View updated display for arrays, including headers indicating class, size, and shape

When displaying output, the Command Window now adds a header that includes the class, size, and shape of a variable. For example:

A = rand(4, 6, 'single')
A =
  4×6 single matrix
    0.8147    0.6324    0.9575    0.9572    0.4218    0.6557
    0.9058    0.0975    0.9649    0.4854    0.9157    0.0357
    0.1270    0.2785    0.1576    0.8003    0.7922    0.8491
    0.9134    0.5469    0.9706    0.1419    0.9595    0.9340
The Command Window displays the new header for most classes other than double and char, including:

singleint8uint8function_handle
logicalint16uint16string
structint32uint32 
cellint64uint64 

The Command Window also displays array dimensions using a standardized format and an improved layout for integer arrays.

Product Trials: Download trials for MathWorks products using Add-On Explorer​

Download and install MathWorks® product trials directly from MATLAB® using the Add-On Explorer. To open the Add-On Explorer, go to the Home tab and click the Add-Ons icon.

Toolbox Packaging: Include live script examples, generate info.xml and helptoc.xml templates for custom documentation, and modify Java class path on installation

When you package a toolbox, MATLAB detects live script examples. Then, when someone installs your toolbox, the examples appear in the MATLAB Help browser.

Integrating your toolbox documentation into the MATLAB Help browser is easier with automatically generated template files. To display your toolbox documentation under Supplemental Software in the Help browser, edit the info.xml and helptoc.xml template files.

MATLAB automatically detects JAR files to include on the dynamic path, and you can manage these files in the Package a Toolbox dialog box.

For more information, see Create and Share Toolboxes.

Preferences: Save preferences to new default location on Mac

MATLAB now saves preferences to your user Application Support folder on Mac OS X systems. The location of the user Application Support folder is ~/Library/Application Support.

Documentation: Find examples faster across MathWorks products

Browse examples across MathWorks products or search for examples using the search box and search filters. To access examples online, go to https://www.mathworks.com/help/examples.html. To access examples in MATLAB, go to the Home tab and click Help > Examples.

Documentation: Open and run examples in MATLAB

Click the Open Script or Open Live Script button in an example to open it in MATLAB. MATLAB copies the example file and all dependent files to the folder userpath/Examples/examplefilename, where examplefilename is the name of the example file. The userpath is the path returned by the userpath command. MATLAB then changes the current folder to the new folder. You can run the example as is or edit it before running.

Language and Programming

Functions in Scripts: Define local functions in scripts for improved code reuse and readability

MATLAB scripts, including live scripts, can contain code to define local functions. Local functions in scripts are useful for experimenting with code within a single file, as well as writing reusable code that can easily be added, modified, and deleted. For more information, see Add Functions to Scripts.

Note

If your script contains local functions, you cannot run code sections (also known as code cells) individually. The Run Section and Run and Advance buttons are disabled. To run the script, type the saved script name in the Command Window or click Run. You can run sections individually in live scripts containing local functions.

string Array: Manipulate, compare, and store text data efficiently​

string arrays provide storage of text data and a set of functions for manipulating text. For example, functions such as contains find text in strings. The split and join functions split and join strings in string arrays. You can compare strings with relational operators such as ==, and sort them with the sort function.

For more information, see Characters and Strings.

timetable Data Container: Manage time-stamped tabular data with time-based indexing and synchronization​​​

The timetable data container is a table that associates a time with each row. Like the table container, the timetable data container stores column-oriented data variables that have different data types and sizes, as long as the data variables have the same number of rows. To create timetables from workspace variables or from tables, use the timetable or table2timetable functions. You can resample or aggregate data in timetables with the retime and synchronize functions. You also can use any table function with timetables.

For more information, see Timetables.

timerange Function: Access all data in a specified date and time range in a timetable

You can create a subscripting variable with the timerange function and use that variable to subscript into a timetable data container.

vartype Function: Access all variables of a specified datatype in a table

You can access all table variables of a specified data type with the vartype function. For example, if T is a table, then S = vartype('numeric'); Tnum = T(:,S) returns Tnum as a table that contains only the numeric variables from T.

table Data Container: Reference all variables in a table with compatible types using the Variables property

You can access all table or timetable variables with compatible types using the Variables property. For example, if T is a 5-by-2 table with two numeric variables, then T.Variables returns a 5-by-2 numeric matrix. T.Variables is equivalent to the T{:,:} syntax.

dir Function: Search for folders and subfolders recursively

Search through folders and subfolders on the path recursively using wildcards in the path name. For more information, see dir.

Note

The * character is now always treated as a wildcard, even on file systems that support * in file names.

Search Path: Add folders to the MATLAB search path using relative paths

When you add a folder to the MATLAB search path using a relative path, MATLAB now adds the absolute path of the folder to the search path. In previous versions of MATLAB, MATLAB added the relative path of the folder, and the path was re-resolved after every change to the current folder.

Compatibility Considerations

If your MATLAB search path contains relative paths to folders, and you rely on the automatic re-resolving of the paths when changing folders, you must update your search path. Use the Set Path dialog box or the addpath or path functions to add the absolute path of folders to the search path. For more information, see Change Folders on the Search Path.

Search Path: Add folders to the MATLAB search path using the MATLABPATH environment variable on Windows

MATLAB now adds the folders specified by the MATLABPATH environment variable to the MATLAB search path on Windows® platforms. This action was previously only done on UNIX® platforms. For more information, see Set the MATLABPATH Environment Variable.

userpath Function: Update code to use simplified userpath on UNIX

As of R2016b, the userpath function now only returns the first folder on the search path. In previous versions of MATLAB, userpath returned the first folder on the search path, appended with the folders listed in the MATLABPATH environment variable for UNIX platforms.

Compatibility Considerations

If you have scripts or functions that rely on the userpath function to return both the first folder on the search path and the paths listed in the MATLABPATH environment variable, then you must update your code. Use the userpath function to receive only the userpath folder, or use the path function to receive the full MATLAB search path.

regexp and regexpi Functions: Force output arguments into a cell array

You can specify the 'forceCellOutput' argument to force the regexp and regexpi functions to return output arguments in a cell array. For example, regexp(str,expression) returns the indices of matches as a numeric array when str is a character vector or a string scalar, but regexp(str,expression,'forceCellOutput') returns the same numeric array within a cell.

regexptranslate Function: Replace matching patterns with escaped regular expression

You can specify the 'flexible' argument when calling regexptranslate to replace matching patterns in text with an escaped regular expression that you specify. The syntax regexptranslate('flexible',str,expression) replaces the same text as regexprep(str,expression,regexptranslate('escape',expression)).

Private Functions: Visibility rules changed

As of R2016b, private functions are visible only to other functions or scripts that are in the folder immediately above the private subfolder (the parent folder). In previous versions of MATLAB, private functions were visible to scripts outside the parent folder if they were called by functions inside the parent folder.

Compatibility Considerations

If you have a function that calls a script outside the parent folder and that script calls a private function, your code might result in an error or change of behavior. If both the function that calls the script and the script that calls the private function are inside the parent folder, then there is no change in behavior.

If the function that calls the script and the script that calls the private function are in different folders:

  • A change in behavior might occur if the script finds a different function with the same name as the private function.

  • An error occurs if the script doesn't find any function with a name that matches the private function name.

Place scripts that need access to private functions to the folder immediately above the private subfolder.

Message Identifiers: Update code to use modified error message identifiers

The error message identifier MATLAB:datatypes:valueOutsideValidRange has changed.

Compatibility Considerations

If you have scripts or functions that use the MATLAB:datatypes:valueOutsideValidRange error message identifier, you must update the code to use one or more of the new identifiers listed here. Typically, you might use error message identifiers in code that uses a try/catch statement and performs an action based on a specific error identifier.

  • MATLAB:datatypes:OutsideRangeFiniteGreater0

  • MATLAB:datatypes:OutsideRangeIntegerGreater0

  • MATLAB:datatypes:OutsideRangeNaN0to1

  • MATLAB:datatypes:OutsideRangeValidNumber

  • MATLAB:datatypes:OutsideRange0to1

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

Calling nargin, nargout, or inputname from within a script

Errors

Move calls to nargin, nargout, and inputname into the relevant function file. If you need the results in a script, call the functions and store the results in a variable. Then use the variable in the script.

If you call nargin, nargout, or inputname from within a script, MATLAB throws an error.

Visibility of local functions

Errors

Store the function handle to the local function in a variable and use that instead of the call to the local function. For example, assign fcn = @myLocalFcn and update the script to use the variable fcn instead of calling myLocalFcn directly.

Local functions are visible only to other functions in the same file. Previously, if a function file that defines local functions invoked a script, that script could call those local functions.

Scripts that call private functions, but do not reside in the folder immediately above the private subfolder

Errors

Store the function handle to the private function in a variable and use that instead of the call to the private function. For example, assign fcn = @myPrivateFcn and update the script to use the variable fcn instead of calling myPrivateFcn directly.

Private functions are visible only to other functions or scripts in the folder immediately above the private subfolder. For more information, see Private Functions: Visibility rules changed.

Linear indexing to expand struct arrays and cell arrays with brace notation

Errors

To use linear indexing to expand a multidimensional struct array or cell array that uses brace notation, first reshape the array to a 1-by-N or N-by-1 array. Alternatively, expand the array using multidimensional indexing.

Previously, linear indexing to expand the bounds of struct arrays or cell arrays using braces would automatically reshape the array to an N-by-1 array.

Deletion of table rows or variables by subscripting into table and assigning empty quotation marks ('')

Errors

To delete table rows or variables, subscript into the table row or variable, and assign empty square brackets ([]) instead of empty quotation marks (''). For example, to delete the first row of table T, use T(1,:) = [] syntax.

Previously, an assignment using empty quotation marks when subscripting into a table would delete table rows or variables.

Deletion of duration or calendarDuration elements by subscripting into array and assigning empty quotation marks ('')

Errors

To delete duration or calendarDuration elements, subscript into the array, and assign empty square brackets ([]) instead of empty quotation marks (''). For example, to delete the second element of duration array D, use D(2) = [] syntax.

Previously, an assignment using empty quotation marks when subscripting into a duration or calendarDuration array would delete elements of such arrays.

Deletion of categorical elements by subscripting into an array and assigning empty quotation marks ('')

Still runs

To delete categorical elements, subscript into the array, and assign empty square brackets ([]) instead of empty quotation marks (''). For example, to delete the second element of categorical array C, use C(2) = [] syntax.

An assignment using empty quotation marks when subscripting into a categorical array now assigns <undefined> elements to the array. Previously, the assignment deleted elements.

Deletion of datetime elements by subscripting into an array and assigning empty quotation marks ('')

Still runs

To delete datetime elements, subscript into the array, and assign empty square brackets ([]) instead of empty quotation marks (''). For example, to delete the second element of datetime array D, use D(2) = [] syntax.

An assignment using empty quotation marks when subscripting into a datetime array now assigns NaT values to the array. Previously, the assignment deleted elements.

Mathematics

Implicit Expansion: Apply element-wise operations and functions to arrays with automatic expansion of dimensions of length 1

Implicit expansion is a generalization of scalar expansion. With scalar expansion, a scalar expands to be the same size as another array to facilitate element-wise operations. With implicit expansion, the element-wise operators and functions listed here can implicitly expand their inputs to be the same size, as long as the arrays have compatible sizes. Two arrays have compatible sizes if, for every dimension, the dimension sizes of the inputs are either the same or one of them is 1. See Compatible Array Sizes for Basic Operations and Array vs. Matrix Operations for more information.

  • Element-wise arithmetic operators+, -, .*, .^, ./, .\

  • Relational operators<, <=, >, >=, ==, ~=

  • Logical operators&, |, xor

  • Bit-wise functionsbitand, bitor, bitxor

  • Elementary math functionsmax, min, mod, rem, hypot, atan2, atan2d

For example, you can calculate the mean of each column in a matrix A, and then subtract the vector of mean values from each column with A - mean(A).

Previously, this functionality was available via the bsxfun function. It is now recommended that you replace most uses of bsxfun with direct calls to the functions and operators that support implicit expansion. Compared to using bsxfun, implicit expansion offers faster speed of execution, better memory usage, and improved readability of code.

Compatibility Considerations

If your code uses any of the element-wise operators or functions listed above and relies on the errors that MATLAB returns from mismatched sizes, particularly within a try/catch block, then your code might no longer catch those errors. This change is because some combinations of input sizes that previously caused errors are now valid.

For example, in older releases of MATLAB, you could not add a row and a column vector, but those operands are now valid for addition with implicit expansion. In other words, an expression like [1 2] + [1; 2] previously returned a size mismatch error, but now it executes.

This compatibility consideration does not apply to any uses of bsxfun.

graph and digraph Objects: Compute graph isomorphism, biconnected components, cut vertices, and node condensation

Graph objects created using either graph or digraph support these functions:

  • isomorphism — Compute graph isomorphism equivalence relation between two graphs.

  • isisomorphic — Determine if two graphs are isomorphic.

Graph objects created using graph support these functions:

  • biconncomp — Compute biconnected components of undirected graph.

  • bctree — Compute block-cut tree of undirected graph.

Graph objects created using digraph support these functions:

  • condensation — Represent each strongly connected component in a directed graph using a single node.

graph and digraph Objects: Visualize graphs and networks in 3-D

The GraphPlot object returned by plotting a graph or digraph now contains a ZData property. If ZData is nonempty, then it specifies z-coordinates for the graph nodes.

Additionally, new layout methods are available for 'force3' and 'subspace3', which automatically calculate values for XData, YData, and ZData to display the graph in three dimensions.

digraph Object: Reverse edge directions in a directed graph using the flipedge function

The flipedge function reverses the direction of directed edges in a graph.

conv2 Function: Compute 2-D convolutions with improved performance

The conv2 function performs faster when using the syntax conv2(u,v,A), where u and v are vectors and A is a matrix.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations
circshift behavior change for row vectorsStill runsTo preserve previous behavior when operating on row vectors with a scalar shift factor, specify 1 for the dimension argument. For example, use circshift([1 2 3 4],2,1), where 2 is the shift factor and 1 is the dimension.circshift now shifts elements along row vectors when provided a scalar shift factor. For example, circshift([1 2 3 4],2) returns the vector [3 4 1 2]. Previously, circshift returned the original row vector with no shifting.

Graphics

Date and Time Plotting: Use datetime or duration data in common plotting functions, and customize plots with datetime and duration rulers

To plot datetime or duration data, you can use these functions.

barbarh
plotplot3
semilogx (x values must be numeric)semilogy (y values must be numeric)
stemstairs
areamesh
surfsurface
fillfill3
linetext

Also, you can use the new datetime and duration ruler objects to customize the axes. Access the datetime or duration ruler object through the axes object. For example:

d = duration(1,30:33,0);
y = [3 5 2 3];
plot(d,y)
ax = gca;
ax.XAxis
ans = 

  DurationRuler with properties:

             Limits: [01:29:55    01:33:04]
         TickValues: [01:30:00    01:30:30    01:31:00    01:31:30    01:32:00    01:32:29    01:33:00]
    TickLabelFormat: 'hh:mm:ss'

  Show all properties

For a list of object properties, see Datetime Ruler Properties and Duration Ruler Properties.

Compatibility Considerations

When plotting datetime or duration data, consider these changes:

  • The xlim, ylim, zlim, and axis functions no longer accept double values to set the limits for an axis with datetime or duration values.

  • The axis function no longer supports setting the axis limits for axes with mixed data types (numeric, datetime, or duration). Use the xlim, ylim, and zlim functions instead.

  • The XLim, YLim, ZLim, XTick, YTick, and ZTick properties of the axes object now contain datetime or duration values instead of double values. To change the limits or tick values, specify datetime or duration values instead of double values.

  • The XData, YData, and ZData properties now contain datetime or duration values instead of double values. To change the data values, specify datetime or duration values instead of double values.

  • Combining plots that mix different data types along a single axis results in an error. When combining plots, use only one data type per axis.

polarscatter and polarhistogram Functions: Create scatter and histogram plots in polar coordinates

To create scatter plots in polar coordinates, use the polarscatter function. Similarly, you can create histograms in polar coordinates using the polarhistogram function. The polarhistogram function supersedes the rose function.

fimplicit and fimplicit3 Functions: Plot implicit functions of the form f(x,y) = 0 and f(x,y,z) = 0

To plot implicit functions of the form f(x,y) = 0, use the fimplicit function. To plot implicit functions of the form f(x,y,z) = 0, use the fimplicit3 function.

Tick Formatting Functions: Customize text, position, rotation, and format for axis tick labels

You can customize the appearance of the tick values and labels along each axis using tick formatting functions. Use the x-axis, y-axis, and z-axis versions when plotting in Cartesian coordinates. Use the r-axis and theta-axis versions when plotting in polar coordinates.

This table lists the new functions.

FunctionsDescription
xticks
yticks
zticks
rticks
thetaticks
Customize the locations of the tick marks along each axis.
xticklabels
yticklabels
zticklabels
rticklabels
thetaticklabels
Customize the tick labels along each axis.
xtickformat
ytickformat
ztickformat
rtickformat
thetatickformat
Format the tick labels along each axis, such as controlling the number of decimal values shown or displaying the values as currency values.
xtickangle
ytickangle
ztickangle
rtickangle
Rotate the tick labels along each axis.

errorbar Function: Create vertical and horizontal error bars and control hat width

To plot both vertical and horizontal error bars, use the errorbar function. Also, you can control the width of the caps at each end of the error bars by setting the CapSize property of the errorbar object.

x = 1:10;
y = sin(x);
err = std(y)*ones(size(x));
e = errorbar(x,y,err,'horizontal')
e.CapSize = 10;

These new errorbar object properties control the lengths of the error bars in each direction:

  • XNegativeDelta and XNegativeDeltaSource — Length of left side of horizontal error bars

  • XPositiveDelta and XPositiveDeltaSource — Length of right side of horizontal error bars

  • YNegativeDelta and YNegativeDeltaSource — Length of lower portions of vertical error bars

  • YPositiveDelta and YPositiveDeltaSource — Length of upper portions of vertical error bars

Compatibility Considerations

These errorbar object properties still run, but have been replaced with new properties.

Replaced Property Use This Property Instead
LDataYNegativeDelta
UDataYPositiveDelta
LDataSourceYNegativeDeltaSource
UDataSourceYPositiveDeltaSource

plot Function: Control location and frequency of markers with the MarkerIndices property

To control the data points at which markers display, use the MarkerIndices property of lines. For example, this code displays a marker every 10 data points.

x = linspace(0,10,500);
y = sin(x);
plot(x,y,'-o','MarkerIndices',1:10:length(y))

histogram and histogram2 Functions: Create a histogram from precomputed bin counts

Plot histograms using histogram and histogram2 by directly passing in the bin counts. When you use this method, histogram and histogram2 do not do any data binning.

Contour Plots: Generate contour matrix with improved performance

Commands that require computing the contour matrix now perform faster, such as:

  • Returning the contour matrix as an output argument from the contour or contourf functions

  • Querying the value of the ContourMatrix property of a contour object

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

legend function

Still runs

Not applicable

The behavior of legend has changed.

The legend function now reuses an existing legend. Thus, recalling the legend function does not reset properties such as the location or orientation. Previously, the legend function deleted any existing legends and recreated a new one.

legend('show')

Still runs

Not applicable

If axes exist and contain no graphics objects, then legend('show') creates an empty legend. Previously, it returned a warning.

rose function

Still runs

polarhistogram functionReplace all instances of the rose function with the polarhistogram function.

xlim, ylim, zlim, and axis functions — Specifying limits as double values for an axis with datetime or duration values

Errors

Not applicableWhen specifying limits for an axis with datetime or duration values, the xlim, ylim, zlim, and axis functions no longer accept double values. Specify datetime or duration values instead.
axis function — Setting limits with different data types

Errors

xlim, ylim, and zlim functionsSetting limits of different data types using the axis function results in an error. Use the xlim, ylim, and zlim functions instead.

XTick, YTick, ZTick, XLim, YLim, and ZLim properties of the axes object — Specifying tick values or limits as double values for an axis with datetime or duration values

Errors

Not applicableWhen specifying tick values or limits for an axis with datetime or duration values, the XTick, YTick, ZTick, XLim, YLim, and ZLim properties of the axes object no longer accept double values. Specify datetime or duration values instead.
XData, YData, and ZData properties of graphics objects

Still runs

Not applicable

When plotting datetime or duration data, the XData, YData, and ZData properties of graphics object now contain datetime or duration values instead of double values. To change the data values, specify datetime or duration values instead of double values.

Combining multiple plots that mix different data types (numeric, datetime, or duration data) along a single axis

Errors

One data type per axisWhen combining plots, use only one data type per axis.

LData errorbar property

Still runs

YNegativeDelta errorbar property

Replace instances of LData with YNegativeDelta.

LDataSource errorbar property

Still runs

YNegativeDeltaSource errorbar property

Replace instances of LDataSource with YNegativeDeltaSource.

UData errorbar property

Still runs

YPositiveDelta errorbar property

Replace instances of UData with YPositiveDelta.

UDataSource errorbar property

Still runs

YPositiveDeltaSource errorbar property

Replace instances of UDataSource with YPositiveDeltaSource.

Default value of Type property for polar axes objects

Still runs

New default value of 'polaraxes'The Type property for polar axes objects now has a default value of 'polaraxes'. In previous releases the value was 'axes'. Update code to use the new value.

Default value of AlignVertexCenters property for errorbar objects

Still runs

Not applicableThe AlignVertexCenters property for errorbar objects now has a default value of 'on'. In previous releases the value was 'off'. Update code to use the new value.

Data Import and Export

readtable Function: Autom​atically detect and return date and time data in text and spreadsheet files

The readtable function detects and returns date and time data as datetime type.

Compatibility Considerations

Previously, readtable function returned date and time data as character vectors. To preserve that behavior use T = readtable(filename,'DatetimeType','text').

dete​ctImportOptions Function: Detect layout of text and Excel files and customize import options to readtable​

You can control and customize how data is imported from text and spreadsheet files using the detectImportOptions function.

The detectImportOptions function returns a SpreadsheetImportOptions object for spreadsheet files and a DelimitedTextImportOptions object for text files. Use these objects with readtable to customize import options, such as:

  • Import bad or missing data.

  • Import only a subset of data using the SelectedVariableNames property.

  • Customize the decimal separator and thousands separator for numeric data using the DecimalSeparator and the ThousandsSeparator properties.

  • Import data as logical variables from a text file.

For more information on properties of objects created by the detectImportOptions function, see SpreadsheetImportOptions and DelimitedTextImportOptions.

VideoReader Object: Read video frames more quickly from MP4 and MOV files on Windows systems

The VideoReader object now supports full rate reading for HD Videos.

imageDa​tastore Function: Read batches of images for faster processing in machine learning and computer vision applications

Now read minibatches from the ImageDatastore object using the ReadSize property. See imageDatastore function.

TallDatastore Object: Efficiently retrieve preprocessed and cleaned-up data saved using the write function of the MATLAB tall arrays

To speed up working with large data files use the TallDatastore object to recreate MATLAB tall arrays from files written to disk by the write function. You can use the TallDatastore object to efficiently load and work with data that has been previously preprocessed and cleaned up.

jsondecode, jsonencode Functions: Encode and decode structured data in JSON-formatted text

Use the jsondecode function to parse JSON text and convert it into MATLAB data types.

Use the jsonencode function to encode MATLAB data into JSON-formatted text.

writetable Function: Support for writing missing fields of a table to a spreadsheet file

You now can write blank cells in place of <missing> values using the writetable function.

readtable, textscan, tabularTextDatastore, and spreadsheetTextDatastore Functions: Support string data type using the 'TextType' parameter

The functions readtable, textscan, tabularTextDatastore, and spreadsheetDatastore support the importing of text as a string data type. For example, to read any text variable in the file myfile.txt as a string array, use T = readtable('myfile.txt','TextType','string'). For more information on string arrays, see Characters and Strings.

weboptions Function: Create custom HTTP headers and specify HTTPS certificates

To create custom HTTP header fields, use the 'HeaderFields' argument in the weboptions function.

To specify HTTPS certificates, use the 'CertificateFilename' argument in the weboptions function.

Scientific File Format Libraries: CDF Library upgraded to version 3.6.1

The CDF library has been upgraded to version 3.6.1.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

movie2avi

ErrorsVideoWriterRemove all instances of movie2avi. Write to AVI files with VideoWriter.

fopen — Specifying the filename argument as a character column vector

ErrorsSpecify filename as a character row vector or a string scalar. When specifying the filename argument, the fopen function no longer accepts a character column vector. Specify filename as a character row vector or a string scalar.

Data Analysis

tall Arrays: Manipulate and analyze data that is too big to fit in memory

Tall arrays provide a way to work naturally with out-of-memory data. Many MATLAB operations and functions work the same way with tall arrays as they do with in-memory arrays. However, tall arrays are not stored directly in memory and are evaluated by request using gather. MATLAB automatically optimizes the queued calculations by minimizing the number of passes through the data. For more information, see Tall Arrays.

You can create tall numeric arrays, cell arrays, categoricals, strings, datetimes, durations, or calendar durations, and you can use any of these tall types as variables in a tall table. For more information, see Functions That Support Tall Arrays (A–Z).

Missing Data Functions: Find, fill, and remove missing data from arrays or tables with ismissing, standardizeMissing, fillmissing, and rmmissing

You can clean missing data from an array or table using the following functions:

  • ismissing — Find elements with missing values.

  • standardizeMissing — Inserts missing value indicators.

  • fillmissing — Replaces missing values with a specified method, such as linear interpolation or a constant value.

  • rmmissing — Removes missing entries.

Cumulative Functions: Ignore NaNs using 'omitnan' in cumsum, cummin, and cummax

You now can exclude NaNs when calculating cumulative statistics with the cumsum, cummin, and cummax functions.

discretize Function: Discretize datetime and duration arrays to separate time-stamped data into regular time intervals

The discretize function accepts datetime and duration arrays as inputs.

Constrained Pan and Zoom: Pan or zoom in a single dimension for 2-D and 3-D plots

You can pan or zoom in a single dimension using the new constrained options.

  • To pan in a single dimension, first enable panning mode; for example, select the pan icon in the figure toolbar. Then, click and drag the tick marks or tick labels of the x-axis, y-axis, or z-axis to pan in that direction. The visual indicates that you are performing a constrained pan operation. Alternatively, right-click the axes and set the pan constraint using the context menu. See pan for information about the programmatic alternative.

  • To zoom in a single dimension, first enable zooming mode; for example, select one of the zoom icons in the figure toolbar. For 2-D plots, click and drag the mouse in approximately the horizontal or vertical direction. The visual indicates that you are performing a constrained zoom operation. Alternatively, right-click the axes and set the zoom constraint using the context menu. For 3-D plots, use the context menu. See zoom for information about the programmatic alternative.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations
getAxesZoomMotion and setAxesZoomMotion object functions for zoom objects

Still runs

getAxesZoomConstraint and setAxesZoomConstraint object functions for zoom objectsReplaces all instances of getAxesZoomMotion with getAxesZoomConstraint. Replace all instances of setAxesZoomMotion with setAxesZoomConstraint.
getAxesPanMotion and setAxesPanMotion object functions for pan objects

Still runs

getAxesPanConstraint and setAxesPanConstraint object functions for pan objectsReplaces all instances of getAxesPanMotion with getAxesPanConstraint. Replace all instances of setAxesPanMotion with setAxesPanConstraint.

App Building

App Designer: Include common 2-D plots in apps, such as area, bar, contour, histogram, yyaxis, and function plots

Now you can display most 2-D plots in your app. For more information, see Graphics Support in App Designer.

App Designer: Create legends for 2-D plots in apps

Add legends and color bars to your plots in App Designer. For more information, see Graphics Support in App Designer.

App Designer: Embed tabular displays using uitable in apps

Use App Designer to display tabular data in your app. Drag a Table component onto the canvas and edit the Data property in the code view to display your data.

If your Table component displays a large number of rows and columns, you might notice a brief delay and a progress indicator as you scroll through the table in your running app. The delay occurs as MATLAB refreshes your data.

App Designer: Create callback functions that can be shared across multiple components

Write a callback function and share it among multiple components in your app. Right-click on a component in the canvas or the Component Browser and select Callbacks from the context menu. The Add Callback Function dialog box allows you to specify a new callback name or select from a list of existing callbacks.

App Designer: Add, position, and resize labeled components, and create components with names derived from labels

  • The resizing behavior of labeled components is improved.

  • The names of labeled components are now based on the label text, making it easier to identify the components in the Component Browser and code view.

  • Ungrouped labels are accessible in the App Designer Component Browser by default.

App Designer: Edit spinners and numeric edit field values directly in the canvas and duplicate components into different parents

  • Now you can edit the default value for a numeric edit field or spinner directly on the canvas.

  • Duplicate any component into a different parent container by pressing Ctrl, selecting the component, and dragging the duplicated component into the target container.

App Designer: Learn App Designer workflow by showing tips in the code view

Click the Show Tips button in the App Designer code view to see a brief overview of the coding workflow. The tips point to specific areas of App Designer and guide you through the basic steps of creating an app.

App Designer Components: Position property uses 1-based origin

The Position property of App Designer components uses a 1-based origin in pixel units. In R2016a, App Designer components used a 0-based origin.

Compatibility Considerations

When you use R2016b to run an App Designer app created in R2016a, the UI components are shifted down and to the left by one pixel. You can use App Designer to correct the issue by opening and saving the app in R2016b before running it.

Similarly, when you use R2016a to run an App Designer app created in R2016b, the UI components are shifted up and to the right by one pixel.

Edit Field Component: Use the ValueChangingFcn property to execute a callback when users edit the value in the UI

ValueChangingFcn is a new property for the EditField component. When you specify a callback for the ValueChangingFcn property, the callback executes as the user edits the value at run time.

Positioning Containers Programmatically: Access the outer bounds and drawable area of containers such as panels and button groups

These containers include an OuterPosition property for accessing the location and size of their outer bounds. They also include an InnerPosition property for accessing the location and size of their drawable area.

uisetcolor Function: Use the redesigned color picker to access recent colors and specify RGB values

The color picker that the uisetcolor function displays has been redesigned to include the following options:

  • A palette of standard colors at the top

  • A palette of recently selected colors in the center

  • RGB input fields that update the color preview as you edit the values

App Packaging: Automatically include dependent files when packaging apps

You no longer need to include files accessed using standard file format functions or low-level I/O functions. The Package App dialog box automatically includes:

  • Files that are accessed using standard file format functions. These dependent files include text, spreadsheets, images, audio, and video files. Scientific data formats are the only standard file formats that are not supported.

  • Files that are accessed using low-level I/O functions.

For a list of supported functions, see Standard File Formats. For a list of supported I/O functions, see Low-Level File I/O.

Performance

Graphics Display: Render plots with large numbers of markers faster using less memory

Graphics that contain large numbers of markers have improved performance and use less memory.

Execution Engine: Execute tight loops with scalar math faster​​

Performance is improved for MATLAB code that is dominated by tight loops, straightforward indexing, and simple math.

Execution Engine: Construct objects faster​​​

Performance is improved for creating simple objects in MATLAB. Improvements apply to MATLAB and MathWorks Toolbox objects (for example, datetime, inputParser) and user-authored objects. For more information, see Object Constructors: Construct objects faster with certain constraints.

Hardware Support

iPhone and Android Sensors: Log data from mobile sensors on the MathWorks Cloud over a Wi-Fi or cellular network​

The MATLAB Support Package for Android™ Sensors and the MATLAB Support Package for Apple iOS Sensors now work on the MathWorks Cloud.

For information about how to connect your Android device to the Cloud, see the “Use MATLAB on the MathWorks Cloud” subsection in “Set Up and Connect to Android Device” in the MATLAB Support Package for Android Sensors documentation.

For information about how to connect your Apple iOS device to the Cloud, see the “Use MATLAB on the MathWorks Cloud” subsection in “Set Up and Connect to Apple iOS Device” in the MATLAB Support Package for Apple iOS Sensors documentation.

Arduino: Write to shift registers

Write to shift registers using the MATLAB Support Package for Arduino® Hardware.

Raspberry Pi: Generate PWM signals and control servo motors from GPIO pins on Raspberry Pi

You can use MATLAB commands to create pulse-width-modulated (PWM) signals and control servo motors from GPIO pins on the Raspberry Pi™ hardware. For more information, see MATLAB Support Package for Raspberry Pi Hardware.

Raspberry Pi: Support for Raspberry Pi 3 Model B

You can use the MATLAB Support Package for Raspberry Pi Hardware with the Raspberry Pi 3 Model B hardware board.

Raspberry Pi: Read​ from sensors and write to the LED matrix on a Raspberry Pi Sense HAT​

You can use the MATLAB Support Package for Raspberry Pi Hardware with Raspberry Pi Sense HAT board to read from the sensors and joystick, and write to the LED matrix.

The components that you can communicate with from the support package are:

  • Humidity sensor - Read the relative humidity and the ambient temperature.

  • Pressure sensor - Read the barometric air pressure and the ambient temperature.

  • IMU sensor

    • Accelerometer - Read the linear acceleration along the x, y, and z axes.

    • Gyroscope - Read the angular velocity along the x, y, and z axes

    • Magnetometer - Read the magnetic field along the x, y, and z axes.

  • Joystick - Read the status of the joystick.

  • LED matrix - Write to a pixel, display an image, or display a message on the 8x8 RGB LED matrix.

Raspberry Pi: Run Linux and file management commands faster

Run Linux® and file management commands faster with performance improvements to the system, getFile, putFile, and deleteFile functions in the MATLAB Support Package for Raspberry Pi Hardware.

Advanced Software Development

matlab.net.http Object: Access HTTP services with low-level protocol control

For more information, see HTTP Interface.

MATLAB Engine API for Java: Run MATLAB code from Java programs

Call MATLAB functions and evaluate MATLAB statements from Java® programs synchronously or asynchronously. Java programs can pass data to and get data from the MATLAB base workspace. For more information, see MATLAB Engine API for Java.

matlab.mixin.SetGet: Allow inexact property names by default in calls to set and get

Classes derived from matlab.mixin.SetGet support inexact property name matching by default in calls to set and get. To require exact property name matching, derive your class from the matlab.mixin.SetGetExactNames class.

matlab.mixin.SetGetExactNames: Require exact property names in calls to set and get

Classes derived from matlab.mixin.SetGetExactNames require case-sensitive, exact property name matches in calls to the set and get methods.

Unit Testing Framework: Generate Microsoft Word or Adobe PDF reports of a test run

Create easily readable, navigable, and archivable reports of your test results using the TestReportPlugin. You can generate reports in .docx and .pdf formats. For more information, see the matlab.unittest.plugins.TestReportPlugin class.

Unit Testing Framework: Improve continuous integration workflows using TAP Version 13 protocol and YAML diagnostics with the TAPPlugin

Use the TAPPlugin to produce a Test Anything Protocol (TAP) stream of your test output. You can integrate this stream into continuous integration systems like Jenkins™ or TeamCity®. The new producingVersion13 method formats the stream using version 13 of the TAP format. With this format, you can include test diagnostics in YAML blocks. For more information, see the producingVersion13 method of the TapPlugin class.

Unit and Performance Testing Frameworks: Improve code reuse and readability by using local functions in script-based tests

As of R2016b, MATLAB scripts can contain local functions. You can use local functions in your script-based unit tests to promote code reuse and readability by defining helper functions for your tests. For an example of local, helper functions in a script-based test, see Write Script-Based Test Using Local Functions.

Unit and Performance Testing Frameworks: Tests that qualify that an empty character vector is a substring now pass

If you use the verifyThat, assertThat, assumeThat, or fatalAssertThat qualifications with the IsSubstringOf constraint to test that an empty character vector is a substring of any nonempty character vector, the qualification now passes. In previous versions of MATLAB, this qualification failed. For example, the following test now passes in MATLAB R2016b.

import matlab.unittest.constraints.IsSubstringOf

tc = matlab.unittest.TestCase.forInteractiveUse;
tc.verifyThat('',IsSubstringOf('any character vector'))
Compatibility Considerations

Prior to MATLAB release R2016b, tests such as testCase.verifyThat('',IsSubstringOf('any character vector')) failed. Update any tests that rely on the previous behavior.

Object Constructors: Construct objects faster with certain constraints

Significant overhead has been removed from object construction. These optimizations result in some changes in the behavior of object constructors, which are described in the next five items.

Compatibility Considerations

Class Destructor Called in Additional Conditions

In previous releases, when an error occurred in the constructor, MATLAB called the class destructor only if an object property was assigned a value in the constructor. With release R2016b, MATLAB also calls the class destructor when an error occurs under these conditions:

  • A reference to the object is present in the code prior to the error.

  • An early return statement is present in the code before the error.

These changes mean that MATLAB calls class destructors in more cases than in previous releases. The destructor must be able to operate on partially constructed objects. For more information, see Support Destruction of Partially Constructed Objects.

Returning Before Calling Superclass Not Allowed

In previous releases, constructors could return conditionally before calling the superclass constructor. With release R2016b, constructors cannot use early returns to conditionalize calls to the superclass constructor.

Revise any constructors that use returns to conditionalize calls to superclass constructors. For more information, see Subclass Constructors.

Path Change in Constructor Applies Immediately

In previous releases, path changes that remove the class of the executing constructor from the path did not affect the visibility of the class. With release R2016b, changes to the path made by the constructor are applied immediately. This new behavior is the same as that of path changes made in ordinary methods.

If a constructor removes the class folder from the path, MATLAB cannot access the class definition. The constructor can use the mlock function to keep the class definition in memory if changing the path in the constructor is necessary.

Changes to Error IDs

Error IDs have changed for certain constructor-related errors. These changes include the IDs for errors thrown for these conditions:

  • Too many inputs

  • Too many outputs

  • Too few inputs

  • Too few outputs

  • Illegal superclass constructor call

Update any error handlers that rely on specific error IDs.

InstanceCreated Event Not Triggered When Constructor Does Not Return Object

If an object constructor does not return the constructed object, MATLAB does not trigger the InstanceCreated event. For more information, see Output Object Not Assigned.

You cannot listen for the InstanceCreated event if an object constructor does not return the constructed object to the caller.

Java: Pass 0-length arrays

MATLAB supports passing empty (0-length) Java arrays to Java methods that take an array of type other than Object.

Compatibility Considerations

Before MATLAB release R2016b, MATLAB converts zero-length Java arrays to null when the method takes an array of type other than Object.

Python Version 3.5: MATLAB support

MATLAB supports the following versions of CPython:

  • Version 2.7

  • Version 3.3

  • Version 3.4

  • Version 3.5

For more information, see Install Supported Python Implementation.

Python Version 3.3: Support to be phased out

Support for Python® version 3.3 will be discontinued in a future release.

Compatibility Considerations

To ensure continued support for your applications, consider upgrading to another supported version of Python — version 3.4 or 3.5.

Source Control Integration: Customize external source control tools to use MATLAB to compare and merge

Use the MATLAB Comparison tool to review changes to files such as live scripts and MAT-files from your external source control client. For more information, see Customize External Source Control to Use MATLAB for Diff and Merge.

Source Control Integration: Include Git Submodules

To reuse code from another repository, you can specify Git™ submodules. For more information, see Add Git Submodules.

Source Control Integration: Fix problems with working copy locks using SVN Cleanup option.

Remove stale working copy locks using the SVN Cleanup option. For more information, see Get SVN File Locks.

Compiler support changed for building MEX files and standalone MATLAB engine and MAT-file applications

SupportCompilerPlatform

Added

GNU® gcc and gfortran version 4.9

Support for GNU gcc and gfortran version 4.7 is discontinued.

Linux

Added

Intel® Parallel Studio XE 2016 for Fortran

Intel Parallel Studio XE 2015 for Fortran

Mac OS X

Discontinued

Microsoft® Visual Studio® 2010 Professional

Windows

To be phased out

Visual C++® 2012 Professional


Apple Xcode 6.2

Windows


Mac OS X

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 website.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

matlab.mixin.SetGet matches inexact property names using set and get methods.

Still runs

To enforce exact property name match, derive from matlab.mixin.SetGetExactNames.

Subclasses of matlab.mixin.SetGet allow inexact property name match by default.

Generating test suites from a class that derives from a concrete base class that defines methods which reference a TestParameter, MethodSetupParameter, or ClassSetupParameter not defined within the base class

Still runs

Define either the:

  • Base class as Abstract using the class-level Abstract attribute. For example, classdef (Abstract) MyTest < matlab.unittest.Testcase.

  • Abstract parameter properties for all parameters used by methods of the class. For example, properties (Abstract,TestParameter).

In future releases, if your test class inherits from a concrete base class that uses a parameter that is not defined in the base class, MATLAB will throw an error.

Calling import from a script

Errors

Replicate the import statements in each function or script where you want to affect the import list.

The import function only affects the import list of the function or script within which it is used. The behavior of calling import at the command prompt is unchanged—it uses the import list for the command environment.

Calling scripts from class methods

Errors

Local functions defined in the class file have access to class members and might provide an alternate approach.

Class methods that call scripts that access private or protected class members from the script cause illegal access errors.

'IgnoringCase' option of these matlab.unittest.constraints classes: CellComparator, PublicPropertyComparator, and StructComparatorErrors'IgnoringCase' option of the IsEqualTo constraintReplace all instances of 'IgnoringCase' in the CellComparator, PublicPropertyComparator, or StructComparator constraint with 'IgnoringCase'in the IsEqualTo constraint.
'IgnoringWhitespace' option of these matlab.unittest.constraints classes: CellComparator, PublicPropertyComparator, and StructComparatorErrors'IgnoringWhitespace' option of the IsEqualTo constraintReplace all instances of 'IgnoringWhitespace' in the CellComparator, PublicPropertyComparator, or StructComparator constraint with 'IgnoringWhitespace' in the IsEqualTo constraint.
'Within' option of these matlab.unittest.constraints classes: CellComparator, PublicPropertyComparator, and StructComparatorErrors'Within' option of the IsEqualTo constraintReplace all instances of 'Within' in the CellComparator, PublicPropertyComparator, or StructComparator constraint with 'Within' in the IsEqualTo constraint.