Main Content

R2016a

New Features, Bug Fixes, Compatibility Considerations

Desktop

Live Editor: Create and run live scripts with embedded output; add equations and images to enhance the interactive narrative

Live scripts combine code, output, and formatted content together in a single interactive environment called the Live Editor. Add formatted text, images, hyperlinks, and equations to create an interactive narrative that can be shared with others.

In the Live Editor you can:

  • Write, execute, and test code in a single interactive environment

  • Generate results and graphics alongside the code that produced them.

  • Run blocks of code individually or run the whole file.

  • See errors at the location in the file where they occur.

  • Include mathematical equations, images, and hyperlinks as supporting material.

  • Share live scripts with other MATLAB® users or convert them to HTML or PDF for publication.

For more information about live scripts, including incompatibilities and information about the Live Script file format, see What Is a Live Script?.

Toolboxes: Programmatically package and install custom MATLAB toolboxes with matlab.addons.toolbox package

Install, uninstall, query, and package toolboxes programmatically.

Tab Completion: Complete parameter names and options in select MATLAB function calls

Complete parameter names and options when entering commands in MATLAB. For example, if you type plot(1:10,' and press the Tab key, MATLAB displays a list of possible parameter names and options for the plot function.

Completion of parameters and options is not available for all functions.

Pause Button: Pause the execution of a program from the Editor and enter debug mode

To pause the execution of a program while it is running, in the Editor tab, click the Pause button. MATLAB pauses execution at the next executable line.

Toolboxes: Customize additions to MATLAB path upon toolbox installation

You can indicate which folders are excluded from the user’s MATLAB path when they install your toolbox. By default, any of the toolbox folders that are on your path when you create the toolbox are added to the user’s path. For more information, see Create and Share Toolboxes.

Preferences: Migrate preferences from MATLAB versions up to three releases preceding the release starting up

MATLAB can now migrate preferences from MATLAB versions up to three releases immediately preceding the release starting up. For example, if you start MATLAB R2016a for the first time and a preferences folder exists for R2014b, MATLAB migrates the preferences from R2014b to R2016a. If two or more preferences folders for the previous three releases exist, MATLAB imports the preferences from the latest preferences folder. For more information, see Preferences MATLAB Uses When Multiple Releases Are Installed.

Compatibility Considerations

On Mac platforms, migrating preferences might result in an out-of-date MEX options file. For more information, see SDK "macosx10.8" cannot be located Error Message.

Internationalization: Default encoding scheme on Mac platforms will change in a future release

Currently, the default encoding scheme on Mac platforms is determined by the OS X user locale setting. In a future release, the default encoding scheme will be 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 load the files properly.

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

How to Change the MATLAB 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.

  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')

Language and Programming

datetime Object: Set the default locale and format of datetime objects through the Preference panel

View and modify the default locale and format of datetime objects in the Command Window Preferences. For more information, see Set Command Window Preferences.

zeros, ones, and eye Functions: Create logical arrays

You can specify logical output with the zeros, ones, and eye functions.

cellstr, deblank, and strtrim Functions: Keep significant whitespace characters when removing leading or trailing whitespace

The cellstr, deblank, and strtrim functions no longer remove significant leading or trailing whitespace characters, such as nonbreaking space characters. The most common whitespace characters that are significant are char(133), char(160), char(8199), and char(8239).

Compatibility Considerations

Prior to MATLAB release R2016a, the cellstr, deblank, and strtrim functions removed all leading or trailing whitespace characters, including significant whitespace characters.

rowfun and varfun Functions: Create output table without row names when using the 'GroupingVariables' parameter

The rowfun and varfun functions no longer add row names to the output table when you use the 'GroupingVariables' parameter to specify the grouping variables.

Compatibility Considerations

Prior to MATLAB release R2016a, the rowfun and varfun functions added row names to the output table when using the 'GroupingVariables' parameter. To add row names, assign them to the RowNames property of the output table. For more information on table properties, see Table Properties.

Debugging: Set breakpoints while MATLAB is executing

You can now set breakpoints at any time, whether MATLAB is idle or busy running a file.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

Calling nargin, nargout, or inputname from within a script

Still runs

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 in future releases.

Visibility of local functions

Still runs

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.

In future releases, local functions are visible only to other functions in the same file. Currently, if a function file that defines local functions invokes a script, that script can call those local functions.

Visibility of private functions

Still runs

Moving scripts that need access to private functions to the folder immediately above the private subfolder might provide an alternate approach.

In future releases, private functions are visible only to other functions or scripts in the folder immediately above the private subfolder. Currently, private functions are available to scripts outside the parent folder that are called by functions residing in the parent folder.

nargchk

Warns

narginchk

Replace all instances of nargchk with narginchk.

Mathematics

Moving Statistics Functions: Calculate moving statistics using the movmean, movsum, movmedian, movmax, movmin, movvar, and movstd functions

You now can compute statistics in a sliding window along a dimension of an array with the movmean, movsum, movmedian, movmax, movmin, movvar, and movstd functions.

datetime and duration Arrays: Compute standard deviations with std

The std function can calculate the standard deviation of a datetime or duration array.

datetime and duration Arrays: Ignore NaNs and NaTs using 'omitnan' or 'omitnat' in the functions mean, median, std, and sum

You now can exclude NaNs from duration arrays when using the mean, median, std, and sum functions.

You also can exclude NaTs from datetime arrays when using the mean, median, and std functions.

graph and digraph Classes: Analyze graphs and networks using centrality and nearest nodes functions

The centrality function computes several different types of node centrality, such as 'degree', 'betweenness', and 'pagerank'. The nearest function calculates the nearest nodes within a specified distance of a source node.

svds Function: Compute singular values with improved performance and convergence behavior with a wide variety of matrices

The algorithm of the svds function shows improved performance and convergence behavior with a wide variety of matrices.

Compatibility Considerations

Three new options for sigma are being introduced to svds to calculate the largest and smallest singular values of a matrix: 'largest', 'smallest', and 'smallestnz'. Previously, using a value of 0 for sigma was common when calculating the smallest singular values.

svds(A,k,0) now returns a warning. Use svds(A,k,'smallest') to find the smallest singular values instead.

median Function: Compute medians with improved performance

The median function computes the median of an array faster.

cummin, cummax, cumprod, and cumsum Functions: Compute cumulative minimum, maximum, product, and sum with improved performance

Calculating the cumulative minimum, maximum, product, and sum with the cummin, cummax, cumprod, and cumsum functions is now faster.

GraphPlot Objects: Interactively inspect graph plots using data cursor and plot selection

You now can use the data cursor to select nodes in a graph and display basic information, such as the node ID and degree. See Display Data Values Interactively for more information about data cursors, or Add Node Properties to Graph Plot Data Cursor for an example involving a graph plot.

Selecting a graph plot also enables the use of plot tools to interact with the graph, such as Plot Browser and Property Editor. See Customize Graph Using Plot Tools for more information.

Graphics

polarplot Function: Plot data in polar coordinates and modify properties of polar axes

To plot data in polar coordinates, use the polarplot function. You can modify the resulting polar axes, such as changing the limits or orientation, by setting Polar Axes Properties.

The polarplot function supersedes the polar function.

yyaxis Function: Create charts with two y-axes and customize each y-axis individually

To create charts with two y-axes, use the yyaxis function. You can plot data against either y-axis using common charting functions, such as plot or errorbar. You can customize each y-axis by setting properties of the axes object.

The yyaxis function supersedes the plotyy function. For an example of its use, see Create Chart with Two y-Axes.

Legend Object: Add legend title and create callbacks to highlight plots when clicking legend items

To add a title to a legend, use the new Title property of the legend or using the title function, for example:

plot(rand(3))
l = legend('Line 1','Line 2','Line 3');
title(l,'My Legend')

Also, now you can highlight charts in the axes when you click the associated legend item. Set the new ItemHitFcn property of the legend to a callback function that changes properties of the charts. For an example, see Create Interactive Legends Using Callbacks.

histogram2 Function: Enable data linking and brushing for bivariate histograms

You now can link and brush data in histogram2 plots.

Function Plots: Visualize mathematical expressions as parametric line, surface, and contour plots

Plot mathematical expressions using a family of new and updated function plots. These functions supersede the existing ez family of functions, such as ezplot.

  • fplot plots 2-D lines, including parametric lines. Supersedes ezplot.

  • fplot3 plots 3-D parametric curves. Supersedes ezplot3.

  • fcontour plots 2-D contours. Supersedes ezcontour.

  • fsurf plots 3-D surfaces, including parametric surfaces. Supersedes ezsurf.

  • fmesh plots 3-D meshes, including parametric meshes. Supersedes ezmesh.

Compatibility Considerations

The behavior of fplot changed in these ways:

  • Issues a warning when using a string to define the function to plot. Instead, use an anonymous function or a function handle.

  • Issues a warning when returning two output arguments. Instead, return the function line object and use its XData and YData properties.

  • No longer supports specifying the y-axis limits as an input argument. Instead, use the ylim function.

  • No longer supports specifying the number of evaluation points as an input argument. Instead, specify the MeshDensity property.

  • No longer supports specifying the error tolerance as an input argument.

Graphics Display: Render plots with large numbers of markers faster

Graphics that contain markers have improved performance and quality. For more information, see opengl.

3-D Pan and Zoom: Explore data with improved pan and zoom behavior for axes in a 3-D view

For axes in a 3-D view, panning and zooming now shift the view of the data by modifying the axis limits, instead of moving the entire axes. The axes box stays in the same location within the figure. Previously, panning and zooming modified camera properties, which moved the entire axes around within the figure.

Compatibility Considerations

If you have an axes in a 3-D view, then the behavior of pan and zoom is different. For the old behavior, use one of these options:

  • Use the context menus when in pan or zoom mode. For example, when you are in zoom mode, right-click over the axes and select 3D Options > Camera Pan and Zoom.

  • Use the setAxes3DPanAndZoomStyle function to specify the behavior, for example:

    ax = gca;
    z = zoom;
    setAxes3DPanAndZoomStyle(z,ax,'camera')

  • Use the camera toolbar. To view the camera toolbar, select View > Camera Toolbar from the figure menu.

Graphics Drivers: Use latest drivers to avoid instabilities with older NVIDIA Windows drivers

If you are using a Windows NVIDIA® graphics driver older than version 9.18.13.4052 (or 340.52 in NVIDIA driver version convention), then MATLAB reverts to using software OpenGL® instead of hardware-accelerated OpenGL. Hardware-accelerated OpenGL is not available by default due to known instabilities with the driver when running MATLAB. To take advantage of all the visual and performance benefits of hardware-accelerated OpenGL, update your graphics driver to the latest version. For more information, see System Requirements for Graphics.

Printed Figure Size: Print or save figures that match size of the figure on the screen by default

Printed and saved figures now match the size of the figure on the screen by default. Previously, printed and saved figures were 8-by-6 inches by default. This change affects figures printed to a printer or saved to a bitmap image or vector graphics file format, for example, using the print and saveas functions.

Compatibility Considerations

The size of printed or saved figures might be different because now the default value for the PaperPositionMode property of figures is 'auto' instead of 'manual'. To get the previous behavior, set the default value back to 'manual' using one of these techniques:

  • Use the new print preference option. Print preferences persist across MATLAB sessions. You can set the print preference to either 'auto' (new behavior) or 'manual' (previous behavior), for example:

    matlab.graphics.internal.setPrintPreferences('DefaultPaperPositionMode','manual')
    To query the current print preference value, use the following command. If you set a preference, then the command returns 'auto' or 'manual'. If you did not set a preference, then the command returns 'unset'.
    matlab.graphics.internal.getPrintPreferences

  • Set the default value on the root object. This option affects only new figures in the current MATLAB session.

    set(groot,'defaultFigurePaperPositionMode','manual')
    For an existing figure, set the PaperPosition property to 'default', for example:
    set(gcf,'PaperPosition','default')

print Function: Print figures that fill page using the '-fillpage' and '-bestfit' options

Print or save figures that fill the page using the new '-fillpage' and '-bestfit' options for the print function. These options maximize the size of the figure while leaving a minimum page margin of 0.25 inch. The '-bestfit' option preserves the figure’s aspect ratio. The '-fillpage' option ignores the aspect ratio. Both options are valid only when printing a figure to a printer or saving it to a paged format (PDF and full page PostScript®).

Figure Menu: Save figures that honor the PaperPosition value using File > Save As

When you save a figure using File > Save As, the size of the saved figure now honors the figure’s PaperPosition property value. By default, the PaperPosition property recalculates according to the size of the figure on the screen. As a result, the saved figure matches the size of the figure on the screen. However, if you change the PaperPosition property value, then the saved figure uses the specified size. Previously, the saved figure matched the size of the figure on the screen regardless of the PaperPosition property value. For the old behavior, set the figure's PaperPositionMode property to 'auto' before saving the figure:

set(gcf,'PaperPositionMode','auto')

Compatibility Considerations

The size of saved figures might be different.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations
plotyy functionStill runsyyaxisReplace all instances of plotyy with yyaxis.
polar functionStill runspolarplotReplace all instances of polar with polarplot.
ezplot functionStill runsfplotReplace all instances of ezplot with fplot.
ezplot3 functionStill runsfplot3Replace all instances of ezplot3 with fplot3.
ezcontour functionStill runsfcontourReplace all instances of ezcontour with fcontour.
ezcontourf functionStill runsfcontourReplace all instances of ezcontourf(...) with fcontour(...,'Fill','on').
ezsurf functionStill runsfsurfReplace all instances of ezsuf with fsurf.
ezsurfc functionStill runsfsurf

Replace all instances of ezsurfc(...) with fsurf(...,'ShowContours','on').

ezmesh functionStill runsfmeshReplace all instances of ezmesh with fmesh.
ezmeshc functionStill runsfmesh

Replace all instances of ezmeshc(...) with fmesh(...,'ShowContours','on').

PaperPositionMode property of figure objectsDefault value now 'auto'Not applicable

Printed and saved figures now match the size of the figure on the screen by default.

[l,icons,plots,txt] = legend(__) syntaxStill runsl = legend(__) syntaxRemove all instances of the [l,icons,plots,txt] = legend(__) syntax. You can make some modifications to the legend by returning the legend object and setting legend properties instead. For a list, see Legend Properties. For information on new legend properties, see Legend Object: Add legend title and create callbacks to highlight plots when clicking legend items.

App Building

App Designer: Build MATLAB apps with line and scatter plots using an enhanced design environment and an expanded UI component set

App Designer is a rich application development environment for developing apps. Major App Designer features include:

  • Numerous user interface components

    In addition to standard components, such as buttons, check boxes, and panels, App Designer also offers gauges, lamps, knobs, and switches.

  • Integrated editor, property sheets, and property inspector

    The editor generates code as you lay out your app and customize component properties. The editor has coding alerts and many of the debugging features that are available in the MATLAB Editor. The integrated property sheets enable you to set commonly used properties for components, such as default component values, text, and text font styles. The property inspector provides access to all writable properties.

  • Enhanced code structure

    App Designer generates code based on your component selection and layout. App Designer structures the code for readability and does not generate unnecessary code. In addition, Areas that App Designer manages are set to read-only access, so you cannot accidentally overwrite or delete required code.

If you built apps using GUIDE in the past, be aware that there are some important differences between GUIDE and App Designer in terms of functionality and support for graphics workflows. For more information, see:

To get started using App Designer, see Create Simple App Using App Designer.

Data Import and Export

writetable Function: Write to text files significantly faster, especially for large files

Performance improvement of the writetable function increases with table size.

readtable Function: Read from Excel files with faster performance

The readtable function reads faster from Excel® files.

writetable Function: Write to Excel files on Mac and Linux platforms

In addition to Windows, the writetable function now writes to Excel files on Mac and Linux®.

Compatibility Considerations

If you specify a range that exceeds the data being written, then writetable will not write to those cells. Previously, writetable filled the remaining cells with #N/A.

When writing NaT datetime values or <undefined> categorical values, writetable writes empty cells instead of NaT and <undefined>, respectively.

spreadsheetDatastore Function: Import and process data from a collection of Excel files

The spreadsheetDatastore function creates a SpreadSheetDatastore object for processing large collections of Excel files.

datastore Function: Import a TabularTextDatastore object with improved file format detection

The datastore function now detects file formatting more accurately when creating a TabularTextDatastore object.

The datastore function now automatically includes only files with extensions .txt, .csv, .dat, .dlm, .asc, and .text by default.

Compatibility Considerations

If you want to include unsupported text file extensions, then specify them using the 'FileExtensions' parameter in the datastore function.

ImageDatastore Object: Specify image labels using the Labels property and process with splitEachLabel, countEachLabel, and shuffle functions

You now can organize an ImageDatastore according to specified labels using the Labels property. When creating an ImageDatastore object, you can use the LabelSource parameter to assign label names according to the file folder names. Labeling is useful for workflows in machine learning and neural networks, for example.

The splitEachLabel function creates new ImageDatastore objects according to a specified number or percentage of images from each label. splitEachLabel can also draw images randomly. This function is useful for testing and training sets, for example.

The countEachLabel function creates a summary table of all labels in the ImageDatastore and how many files belong to each.

The shuffle function randomly reorders the files in the original ImageDatastore and creates a new one.

fileDatastore Function: Create a custom datastore for a file collection too large to fit in memory

The fileDatastore function creates a custom FileDatastore object that uses a specified custom read function to import the files.

readtable Function: Read text files with automatic detection of delimiters, header lines, and variable names

The readtable function automatically detects delimiters, header lines, and variable names in text files.

Compatibility Considerations

You can restore the previous readtable defaults by specifying the delimiter, header line, or variable name parameter values explicitly, for example, readtable('file.txt','Delimiter',',','HeaderLines',0,'ReadVariableNames',true);

tabularTextDatastore and imageDatastore Functions: Create objects to import large text and image data collections

You now can use the tabularTextDatastore function to conveniently create a TabularTextDatastore object for large collections of text files.

You can use the imageDatastore function to conveniently create an ImageDatastore object for large collections of image data.

writetable Function: Detect text with embedded delimiters automatically and write as quoted text

The writetable function automatically detects and adds quotations around text, categorical, and datetime variables containing an embedded delimiter (such as '\t').

TabularTextDatastore Objects: Read text files with automatic detection of delimiters, header lines, and variable names

You now can read from a TabularTextDatastore object with automatic detection of the Delimiter, NumHeaderLines, and ReadVariableNames properties. For more information, see TabularTextDatastore Properties.

Compatibility Considerations

You can restore the previous TabularTextDatastore defaults by specifying the delimiter, header line, or variable name parameter values explicitly, for example, tabularTextDatastore('file.txt','Delimiter',',','NumHeaderLines',0,'ReadVariableNames',true);

imread Function: Generate C-code using MATLAB Coder

The imread function generates C-code for 8-bit grayscale and 24-bit truecolor JPEG images using a platform-specific shared library.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations
KeyValueLimit property of the KeyValueDatastore classErrorsReadSize property of KeyValueDatastore classReplace all instances of KeyValueLimit with ReadSize.

RowsPerRead property of the TabularTextDatastore class

ErrorsReadSize property of TabularTextDatastore classReplace all instances of RowsPerRead with ReadSize.
Folders and wildcard (*) characters in the Files property of the KeyValueDatastore and TabularTextDatastore classesErrorsFull paths and file namesReplace all folder names or wildcard characters with full path and file names when assigning to the Files property.

Performance

Performance Testing Framework: Measure MATLAB code performance using the unit testing framework

Measure the performance of your MATLAB code using the performance testing framework. The framework includes performance measurement-oriented features such as running your code several times to "warm-up" the code and accounting for noise in the measurements.

The performance test interface leverages the script, function, and class-based unit testing interfaces. Therefore, you can perform qualifications within your performance tests to ensure correct functional behavior while measuring code performance. Also, you can run your performance tests as standard regression tests to ensure that code changes do not break performance tests.

For more information, see Performance Testing Framework.

Graphics Display: Render plots with large numbers of markers faster

Graphics that contain markers have improved performance and quality. For more information, see opengl.

writetable Function: Write to text files significantly faster, especially for large files

Performance improvement of the writetable function increases with table size.

readtable Function: Read from Excel files with faster performance

The readtable function reads faster from Excel files.

median Function: Compute medians with improved performance

The median function computes the median of an array faster.

cummin, cummax, cumprod, and cumsum Functions: Compute cumulative minimum, maximum, product, and sum with improved performance

Calculating the cumulative minimum, maximum, product, and sum with the cummin, cummax, cumprod, and cumsum functions is now faster.

Hardware Support

Raspberry Pi: Acquire images from USB webcams

Use the MATLAB Support Package for Raspberry Pi™ Hardware to bring live images into MATLAB from USB webcams attached to your Raspberry Pi hardware board.

With simple MATLAB functions preview and acquire single snapshots from the camera, and optionally set up a loop of acquired images. The webcam function creates the USB Camera object used to acquire images, and the snapshot function returns a single image from the camera.

Arduino: Build custom add-ons to interface with additional hardware and software libraries

MATLAB Support Package for Arduino® Hardware provides a framework of classes that you can use to create custom applications to use with your Arduino device. The custom applications can be code, libraries, or devices that work with an Arduino. For more information, see Custom Arduino Add-On Device, Library, and CodePerformance Testing Framework in the MATLAB Support Package for Arduino Hardware documentation.

To install the support package, on the MATLAB Home tab, in the Environment section, click Add-Ons > Get Hardware Support Packages.

Advanced Software Development

Performance Testing Framework: Measure MATLAB code performance using the unit testing framework

Measure the performance of your MATLAB code using the performance testing framework. The framework includes performance measurement-oriented features such as running your code several times to "warm-up" the code and accounting for noise in the measurements.

The performance test interface leverages the script, function, and class-based unit testing interfaces. Therefore, you can perform qualifications within your performance tests to ensure correct functional behavior while measuring code performance. Also, you can run your performance tests as standard regression tests to ensure that code changes do not break performance tests.

For more information, see Performance Testing Framework.

Unit Testing Framework: Quickly create explicit test suites using testsuite function

Use the testsuite function to create a suite of tests from your current working folder or from specified test content. If you have an explicit test suite, you can use test selectors and test runners.

In previous releases of MATLAB, you create explicit test suites with the methods in the matlab.unittest.TestSuite class. The testsuite function provides a more convenient means to create test suites.

Unit Testing Framework: Access diagnostic information recorded on test results

You can programmatically access the diagnostic information on test results using a DiagnosticsRecordingPlugin. The DiagnosticsRecordingPlugin class records test qualification failures and events logged at Terse verbosity. However, you can configure the plugin to record passing diagnostics and logged messages at different verbosity levels.

If you run tests with the runtests function or the run method of TestSuite or TestCase, then the test framework uses a DiagnosticsRecordingPlugin plugin by default. Also, if you run performance tests with the runperf function or the run method of TimeExperiment, then the test framework uses this plugin by default.

For more information, see matlab.unittest.plugins.DiagnosticsRecordingPlugin.

Unit Testing Framework: Create temporary working folder using the WorkingFolderFixture

The matlab.unittest.fixtures.WorkingFolderFixture class provides a fixture that creates a temporary folder and sets it as the current working folder. The test or the product under test can create files and modify the contents of the folder without affecting the source code or test folder structure.

Although both the WorkingFolderFixture and TemporaryFolderFixture classes create a temporary folder, the WorkingFolderFixture also sets the folder as the current working folder. At fixture teardown, the testing framework restores the current working folder to its previous state.

For more information, see matlab.unittest.fixtures.WorkingFolderFixture.

Unit Testing Framework: Test set membership and uniqueness with HasUniqueElements, IsSubsetOf, and IsSupersetOf constraints

You can test set membership and uniqueness of the actual value set using set constraints in the matlab.unittest.constraints package. For example:

  • HasUniqueElements tests if an actual value set has unique elements.

  • IsSubsetOf tests if an actual value set is a subset of the expected value set.

  • IsSupersetOf tests if an actual value set is a superset of the expected value set.

Unit Testing Framework: Set up custom fixture to delegate work to another fixture

The matlab.unittest.fixtures.Fixture class enables you to create custom fixtures to configure the environment state required for tests. The applyFixture method of the Fixture class enables your custom fixture to delegate work to another fixture. When the testing framework tears down the custom fixture, it also tears down the fixture you used to set it up.

For more information, see matlab.unittest.fixtures.Fixture.applyFixture.

Unit Testing Framework: Exclude specified fields and properties from constraint comparison

When you compare structures using the IsEqualTo or StructComparator classes, specify which fields to ignore using the 'IgnoringFields' name-value pair argument.

When you compare objects using the PublicPropertyComparator with the supportingAllValues static method, specify which properties to ignore using the 'IgnoringProperties' name-value pair argument. If the values are structures, then specify which fields to ignore using the 'IgnoringFields' option.

Unit Testing Framework: Customize how the PathFixture fixture adds folders to the path

Now,you can create a PathFixture fixture that includes subfolders of the specified folder on the path. For more information, see the 'IncludingSubfolders' name-value pair argument of PathFixture.

Additionally, you can have the PathFixture fixture add the folder to the end (bottom) of the path. By default, the fixture adds a folder to the beginning (top) of the MATLAB path. For more information, see the 'Position' name-value pair argument of PathFixture.

Property Definition: Restrict the class of property values

Restrict property values to a specified class or a class compatible with the specified class. For more information, see Restrict Class of Properties.

Property Definition: Define only one property per line in class definitions

Define only one property per line in the property block of a class definition. Also, you cannot define properties on the same line as the properties or end keywords.

Compatibility Considerations

In releases R2016a, MATLAB interprets any name following a property name as a restricting class. The second name is not interpreted as a property name. More than two names on a line cause an error. A single line in a property block can contain the property name, an optional restricting class, and an optional default value. Default values must be of a class that is compatible with the class restriction.

properties
   PropName ClassName = defaultValue;
end

You must change any existing property blocks that list more than one property per line to list only one property per line. The following list describes cases that you must change:

  • The properties keyword is on the same line as property names.

  • The end keyword is on the same line as property names.

  • The entire properties block is on one line using white-space separators.

  • More than two property names are on one line.

MATLAB interprets two property names on one line as a restricted property. If the second name is not a valid class name, MATLAB generates an error.

event.hasListener Function: Determine if an event has listeners

The event.hasListener function returns a logical true or false indicating if listeners exist for a specific event name and event source.

event.DynamicPropertyEvent Class: Get dynamic property name from event data

The PropertyAdded and PropertyRemoved events provide an event.DynamicPropertyEvent object as the event data that is passed to listeners of those events. This event data object has a property, PropertyName, that contains the name of the dynamic property whose addition or removal triggered the respective event.

Enumerations: Substitute character arrays using new class methods

Enumerations have improved compatibility with character arrays and cell arrays of strings. This compatibility enables conversion of characters to enumerations and the use of enumeration members in set membership and string comparison functions. For more information, see Conversion of Characters to Enumerations and Operations on Enumerations.

waitfor Function: Suspend execution of pending operations on any handle object

With release R2016a, the waitfor function works with any instance of a MATLAB handle class.

Source Control Integration: Display relation of local changes to remote branch

If you are using Git™ for source control, you can view information about your current branch relative to the remote tracking branch in the repository. Right-click the file or white space of the Current Folder browser and select Source Control > View Details. The Git information field indicates whether your committed local changes are ahead of, behind, or coincident with the remote tracking branch.

Source Control Integration: View summary status icon for folders

If you have folders in your source control repository, the Current Folder browser shows an icon for the folder that summarizes the status of the contents of the folder. The tooltip for the icon displays a summary of the changes in the folder.

If the source control system supports storing folders, the Current Folder browser displays the appropriate status icon for the folder and its contents. Otherwise, it displays either a dot indicating that the folder is not under source control or the Modified icon to indicate that files within the folder are modified. SVN supports storing folders, but Git does not.

MATLAB Engine for Python: Start or connect asynchronously to MATLAB from Python

You can start the MATLAB Engine for Python® asynchronously using the async keyword argument in the matlab.engine.start_matlab and matlab.engine.connect_matlab commands.

MATLAB builds with Boost library version 1.56.0

MATLAB builds with an updated version of the Boost library, version 1.56.0.

Compatibility Considerations

If you use any Boost library in a MEX function, you might not be able to load that function if you do not use Boost library version 1.56.0.

MEX command does not accept .bat or .sh compiler options files

The mex command -f option does not accept arguments with .bat or .sh file extensions.

Instead of using the -f option to specify a compiler, use the work flows described in Change Default Compiler.

You can modify compiler build options using mex command options. For example, use the -L and -I options to locate libraries on your system. Use the varname=varvalue option to pass options to the compiler.

For the complete list of mex command options, see the option1 ... optionN input argument.

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

SupportCompilerPlatform

Added

Intel® Parallel Studio XE 2016


Intel Parallel Studio XE 2015


Intel C++ Composer XE 2013 with Microsoft® Visual Studio® 2013

Windows

Added

Apple Xcode 7.x

Mac OS X

Discontinued

Microsoft Visual Studio 2008 Professional Edition


Intel C++ Composer XE 2011 with Microsoft Visual Studio 2010


Intel Visual Fortran Composer XE 2011 with Microsoft Visual Studio 2010

Windows

To be phased out

Microsoft Visual Studio 2010 Professional Edition


Microsoft Windows SDK 7.1

Windows

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

Calling import from a script

Still runs

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

In future releases, the import function only affects the import list of the function or script within which it is used. Currently, if you call import in a script that is invoked from a function, it affects the import list of the function. The behavior of calling import at the command prompt is unchanged—it uses the import list for the command environment.

Calling clear import from a script

Still runs

In future releases, most of the calls to clear import from a script are unnecessary because the import statements are scoped to the script.

In future releases, calling clear import from a function or script returns an error. Currently, this action returns an error from within a function.

Calling scripts from class methods

Still runs

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

In future releases, class methods that call scripts that access private or protected class members from the script cause illegal access errors.

'Recursively' option of runtestsStill runs'IncludeSubfolders' and 'IncludeSubpackages' options of runtestsIn calls to runtests, replace all instances of 'Recursively' with 'IncludeSubfolders' and/or 'IncludeSubpackages'

Creating a dynamic property with an invalid name

ErrorsFor valid names, see Name Dynamic Properties.Creating a dynamic property with an invalid name causes an InvalidDynamicPropertyName error. Previous releases issued a warning.
'IgnoringCase' option of these matlab.unittest.constraints classes: CellComparator, PublicPropertyComparator, and StructComparatorWarns'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 StructComparatorWarns'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 StructComparatorWarns'Within' option of the IsEqualTo constraintReplace all instances of 'Within' in the CellComparator, PublicPropertyComparator, or StructComparator constraint with 'Within' in the IsEqualTo constraint.