Main Content

R2018a

New Features, Bug Fixes, Compatibility Considerations

Desktop

Live Editor: Create live functions with richly formatted documentation, including equations and images

In the Live Editor, you can create live functions that accept inputs and return outputs. To document your live functions, add richly formatted text, which includes equations, images, and formatted code examples. Then, you can use the doc command to view the documentation in the Help browser. For more information, see Create Live Functions.

Live Editor: Debug live functions and scripts

To diagnose problems in live functions and live scripts, debug your code in the Live Editor. You can use several methods to debug in the Live Editor:

  • Show output by removing semicolons.

  • Run to a specific line of code and pause using the button.

  • Investigate called functions and scripts by stepping in using the button.

  • Add breakpoints to your file to enable pausing at specific lines when you run the file.

For more information, see Debug Code in the Live Editor.

Live Editor: Add sliders and drop-down lists to control variable values in a live script

You can add sliders and drop-down lists to your live scripts to interactively control variable values. Adding interactive controls to a live script is useful when you want to share the live script with others. Use the controls to define and limit the values of variables that others can change in your live script.

To add a numeric slider or drop-down list, go to the Insert tab, click Control, and select from the available options. For more information, see Add Interactive Controls to a Live Script.

Live Editor: Sort table data interactively

In the Live Editor, you can sort table data interactively. To sort data in a table, click the down arrow to the right of a variable name in the table and select from the available sorting options.

Use the Update Code button below the table to add the generated code to your live script. Adding the generated code to your live script ensures that the sorting is reproduced the next time you run the live script.

Live Editor: Create a table of contents and add formatted code examples​

You can create tables of contents in live scripts and functions that contain a list of all the titles and headings in the document. To insert a table of contents, go to the Insert tab and select Table of Contents. Only the title of the table of contents is editable.

You also can add formatted code examples to live scripts and functions. A code example is sample code that appears as text. To add a code example, go to the Insert tab, click Code Example and select Plain. The Live Editor displays the sample code as indented and monospaced text. To add a MATLAB® syntax highlighted code example, go to the Insert tab, click Code Example and select MATLAB.

For more information about adding formatted text to live scripts and functions, see Format Files in the Live Editor.

Live Editor: Select and edit a rectangular area of code

In the Live Editor, you can select a rectangular area in your code (also known as column selection or block edit) by pressing the Alt key while making a selection. Selecting and editing a rectangular area of code is useful if you want to copy or delete several columns of data, or if you want to edit multiple lines at one time. For example, select the second column of data in A.

Type 0 to set all the selected values to 0.

Add-Ons Explorer: Browse by category to discover convenient, helpful add-ons

Use the available categories to browse for new, convenient, and helpful add-ons in the Add-Ons Explorer. For more information about add-ons and how to find and install them, see Get Add-Ons.

Comparison Tool: Find differences in live scripts and functions

Use the Comparison tool to find differences in live scripts and functions. The Comparison tool highlights differences in both the code and the text.

To start a comparison of a live script or function, go to the Live Editor or Home tab, click Compare, and then select the files you want to compare. To start a comparison from the Current Folder browser, select a file, right-click, and select Compare Against.

Favorites: Rerun favorite commands

Create favorite commands (previously called command shortcuts) to easily rerun a group of MATLAB language statements that you use regularly. To access existing favorite commands, go to the Home tab and in the Code section, click Favorites and then select from available favorite commands. To create a new favorite command, click Favorites and then press the New Favorite button. For more information, see Rerun Favorite Commands.

Toolbox Packaging: Specify portability information for custom toolboxes

You can indicate which platforms and MATLAB releases support your custom toolbox. When someone installs your toolbox on an unsupported platform or MATLAB release, MATLAB displays a warning. However, they can still install the toolbox. For more information, see Create and Share Toolboxes.

Language and Programming

Empty Arrays: Create complex empty arrays using functions such as zeros and ones

You can create complex empty arrays using the complex function and functions that support complex input with the 'like' syntax, such as zeros and ones. For example, the commands zeros(0,0,'like',1i) and complex([]) now return complex empty output instead of real empty output.

Compatibility Considerations

Previously, the complex function and functions that support complex input with the 'like' syntax always returned real empty arrays when one or more dimensions were 0. To preserve this behavior, you can check for complex empty arrays using the isreal function and convert them to real empty arrays using the real function.

Code Compatibility Report: Generate compatibility report from Current Folder browser

The Code Compatibility Report displays potential compatibility issues in your code and categorizes them by severity. This report helps you to update code to a newer MATLAB release by grouping issues into those issues that require immediate resolution and those issues you can address in a later release.

As of R2018a, you can generate the Code Compatibility Report from the Current Folder browser. Previously, you generated the report using the codeCompatibilityReport function only. For more information, see MATLAB Code Compatibility Report.

timer Object: Access properties with multilevel indexing

The timer object supports multilevel indexing for setting and accessing properties. For example, consider a timer t with a UserData property that contains a structure. Now you can access the data in the structure directly.

t.UserData.field1

To access the field1 value in previous versions of MATLAB, you either defined an intermediate variable, or used the getfield function.

d = t.UserData;
d.field1

getfield(t.UserData, 'field1')

Now you can set the values in the structure directly.

t = timer;
t.UserData.field1 = 'value1';
t.UserData.field2 = 'value2';

Using dot notation to access properties on an array of timer objects now returns a comma-separated list instead of a cell array. Using dot notation to set properties on an array of timer objects now errors.

Compatibility Considerations

If your code relies on MATLAB returning a cell array when getting the properties for an array of timer objects, either update your code to work with a comma-separated list, or use the get function. This code continues to return a cell array.

t_arr = [timer timer timer];
get(t_arr,'Name')
ans =

  3×1 cell array

    {'timer-5'}
    {'timer-6'}
    {'timer-7'}

To continue to set properties for all elements in an array of timer objects, use the set function.

set(t_arr,'TimerFcn','myFunction')

In MATLAB R2018a and later, using dot notation to set the properties for all timer objects in an array results in an error. For example, t_arr.TimerFcn = 'myFunction' now errors.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

complex function and functions supporting complex input with the 'like' syntax

Still runs

Not applicable

Previously, the complex function and functions that support complex input with the 'like' syntax (such as zeros and ones) always returned real empty arrays when one or more dimensions were 0. To preserve this behavior, you can check for complex empty arrays using the isreal function and convert them to real empty arrays using the real function.

MATLAB path names containing '.', '..', and symbolic links

Still runs

Not applicable

MATLAB now resolves all path names containing '.', '..', and symbolic links to their target location before adding them or removing them from the path. Resolving the path names ensures that each entry in the MATLAB path represents a unique folder location.

For example, if you run the command addpath('c:\matlab\..\work'), MATLAB adds the folder c:\work to the path.

MATLAB also resolves path names when changing the current folder.

For more information, see addpath, rmpath, path, and cd.

Case sensitivity when adding or removing folders to the MATLAB path.Still runs

Not applicable

MATLAB now case corrects path names according to the file system's case characteristics before adding or removing them from the path.

For example, if the folder c:\TEMP exists on your system and you run the command addpath('c:\temp'), MATLAB adds the folder 'c:\TEMP' to the path.

For UNC paths, MATLAB case corrects only the file path part of the path. The server name and share name parts of the path are standardized to all lowercase.

ans in nested functions

Still runs

Not Applicable

Currently, nested functions sometimes can access and modify the ans variable that is defined in the parent function. In future releases, nested functions will never have access to the ans variable defined in the parent function. For example in future releases, in this code, MATLAB throws an error in the nested function.

function foo
    1+2 % Assigns to ans.
    nested()
    function nested
       ans % MATLAB throws an error.
    end
end
To share a value between a nested function and its parent function, assign the value to a variable other than ans.
function foo
    sharedVar = 1+2
    nested()
    function nested
       sharedVar
    end
end

MATLAB classification of identifiers in anonymous functions

Still runs

Not applicable

Currently, if any identifiers in an anonymous function are unknown at creation time, all identifiers are unknown. In a future release, they will be classified using the same rules as if they were inside the function. If an identifier is known in the function, it is known in the anonymous function. For example, consider the following function and its local function.

function myfun 
  myscript; % script sets x = 1 and lf = 10 
  f1 = @()lf(1);
  f2 = @()lf(x);   
end 
function lf(y) 
  % local function to myfun
end 

All identifiers in f1 are known when MATLAB creates the anonymous function. It calls the local function lf with an input of 1. In the current version of MATLAB, since x is unknown, MATLAB considers lf to be unknown also, and resolves both identifiers at runtime. Therefore, it uses x from myscript to index into the variable lf from myscript.

In a future version of MATLAB, lf in f2 will resolve to the local function, since lf is known when the anonymous function is created. x continues to be unknown until runtime. At runtime, MATLAB will use x from myscript as input to the local function lf, instead of as an index to the variable lf from myscript.

MATLAB resolution of identifiers within parfor/spmd blocks

Still runsNot applicable

Currently, MATLAB resolves identifiers in parfor/spmd blocks only within the scope of that block. In a future version of MATLAB, these identifiers will have the same resolution outside the parfor/spmd block. For example, consider the following function.

function myFunc()
    parfor i = 1:2
        y(i); 
    end
    i
end

Currently, inside the parfor block, i is recognized as a variable, but outside of the parfor block, it is an unrecognized function or variable. In a future version of MATLAB, i will be recognized as a variable outside of the parfor loop. However, its value from the parfor loop is not available outside of the block. In this example, the value of i is sqrt(-1) outside of the parfor loop.

Change in precedence of compound name resolution

Still runsNot applicable

In MATLAB, a compound name is a name comprised of several parts joined by a dot. For example structName.fieldName or packageName.ClassName.methodName. In the current version of MATLAB, if a compound name, such as a.b.c, does not resolve to a variable, then it has the following precedence order.

  1. Class called a.b.c

  2. Class called a.b with static method c

  3. Package function called a.b.c

  4. Class called a.b (no static method c)

  5. Class called a

In a future version of MATLAB, if a.b.c does not resolve to a variable, it will have this precedence order.

  1. Class or package function called a.b.c

  2. Class or package function called a.b

  3. Class or function called a

Deleting a folder that was removed outside of MATLABWarnsNot applicableMATLAB now detects and warns if you try to delete a folder that was removed outside of MATLAB.
notebookErrorsLive Editornotebook has been removed. To create a document that combines code, formatted text, and output, use the Live Editor instead.

Change in precedence of *based imports

Warns

To use a package function, use the fully qualified name.

Imports in a function have the highest precedence. Imports shadow variables, local functions, and nested functions. For example,

function myfunc
%import "local" and "nest" functions 
  import pkg1.* 
  local()  % Calls "pkg1.local" 
           % and displays warning. 

  function nest 
  end 

  nest(); % Calls "pkg1.nest" 
          % and displays warning. 
end 

function local 
end

In the future, imported functions will have lower precedence than variables, nested functions, and local functions

function myfunc
%import "local" and "nest" functions  
  import pkg1.* 
  local()  % Calls "myfunc/local"

  function nest 
  end 

  nest(); % Calls "myfunc/nest"
end 

function local 
end

Fully qualified import behavior

Warns

To use a function "nest" from a fully qualified import instead of the nested function with the same name, either remove the import statement or the nested function definition.

A fully qualified import takes precedence over a nested function.

function myfunc 
% import function "nest"
  import pkg.nest  
% Calls "pkg.nest" and displays warning
  nest(); 

  function nest 
  end 
end 
myfunc
Warning: Prec-1.File: myfunc.m Line: 2 Column: 10
 Using "nest" from the fully qualified 
import instead of the nested function
with the same name.
 This will error in a future release. 
Either remove the import statement or 
 the nested function definition.

In the future, fully qualified imports sharing names with identifiers in the same scope will throw an error.

Fully qualified imports with names that shadow identifiers in outer scopes

WarnsNot applicable

A fully qualified import is ignored when it shadows an identifier in the outer scope.

1.function myfunc 
2.  x = 1; 
3.  function nest 
4.    import pkg1.x
% Calls variable "myfunc/x" on line 2 
% and displays warning 
5.    x() 
6.  end 
7.end 
myfunc
Warning 
ID: mir_nr_id_shadows_imported_function 
Message: "x" is both the name of an imported 
function in a nested function and 
the name of a variable in the outer scope.
The imported "x" function is not called.
In future, the imported "x" will be called. 

In the future, fully qualified imports will shadow identifiers in the outer scopes with same name.

1.function myfunc 
2.  x = 1; 
3.  function nest 
4.    import pkg1.x 
5.    x() % Calls imported function "pkg1.x" 
6.  end 
7.end 

Error handling for fully qualified imports that cannot be resolved

Still runsNot applicable

If MATLAB is launched without Java®, then fully qualified imports that cannot be resolved do not throw an error.

If MATLAB is launched with Java, then fully qualified imports that cannot be resolved throw an error.

In the future, fully qualified imports that cannot be resolved throw an error with or without Java.

Imports used in scripts compared with imports used in functions

Still runsNot applicable

If a script contains an import statement and that import statement matches the name of a class on the path, then all uses of that identifier resolve to the class. If the identifier does not resolve to a class at runtime, then an error is thrown.

In the future, imports used in scripts will behave like imports in functions.

Error handling when import not found

Still runs

Remove functions such as javachk and usejava used for error handling.

Fully qualified imports that cannot be resolved throw an error in MATLAB -nojvm mode. For example, create this function.

function myfunc 
  import java.lang.String 
  if ~usejava('jvm') 
    disp('This function requires Java'); 
  else 
    % do something with java String class 
  end 
end

Start matlab -nojvm, and then run the function.

myfunc 
This function requires Java

In the future, MATLAB throws an error. For example:

myfunc 
Unable to find class or function 'java.lang.String' 
(line 2) for import. If your class or function 
requires Java, restart MATLAB without the 
-nojvm option.

Mathematics

graph and digraph Objects: Work with multigraphs that have multiple edges between two nodes

The graph and digraph classes now support multiple edges between two nodes. Repeated edges are distinct and can have different weights. To facilitate working with graphs that have repeated edges, several new functions are available:

  • ismultigraph — Determine whether a graph is a multigraph or a simple graph.

  • simplify — Reduce a multigraph into a simple graph. Optionally, you can specify a rule to combine or pick between repeated edges.

  • edgecount — Count the number of edges between two nodes.

  • outedges, inedges — Find outgoing or incoming edge indices for a particular node.

Additionally, some existing graph functions have updated capabilities to account for multiple edges.

FunctionNew Functionality
shortestpathNew third output that lists the edge indices of all edges on the path.
shortestpathtreeNew third output that indicates whether each edge is in the tree.
highlightAll edges between the source and target nodes are highlighted by default. A new name-value pair 'Edges' enables you to highlight specific edges using indices, which is compatible with the new third output of shortestpath.
bfsearch, dfsearchNew second output that contains the edge index. If the primary output is a table, then it has an additional variable EdgeIndex with the same information.
isomorphismNew second output that contains permutation information of the edges.
findedgeNew second output that contains edge indices.

Compatibility Considerations

There are a few changes that might require updates to existing code:

  1. neighbors function counts self-loops only once. In previous releases, if node u had a self-loop, then neighbors(g,u) listed u twice in the output. neighbors(g,u) now returns only one instance of u.

  2. Display change of self-loops in plot of a simple graph. Self-loops in the plot of a simple graph are now shaped like a leaf or teardrop. In previous releases, self-loops were displayed as circles.

  3. graph, digraph, and addedge no longer produce errors when they encounter duplicate edges. Instead, the duplicate edges are added to the graph and the result is a multigraph. The ismultigraph function is useful to detect this situation, and simplify provides an easy way to remove the extra edges.

graph and digraph Objects: Calculate component sizes and weighted adjacency matrices

The conncomp function offers a second output to return the number of nodes in each connected component. Additionally, the adjacency function accepts a second input to create weighted adjacency matrices.

GraphPlot Object: Visualize graphs with additional options for 'force', 'force3', and 'circle' layouts

When you plot a graph G with a specific layout using plot(G,'Layout',method), you can use a number of layout-specific name-value pairs for each of the different methods. For example, plot(G,'Layout','layered','Direction','left') changes the orientation of a layered layout.

New layout-specific name-value pairs for visualizing directed and undirected graphs with the plot function include:

  • 'WeightEffect' name-value pair — To incorporate edge weights into the 'force' and 'force3' layouts.

  • 'UseGravity' name-value pair — To turn the effects of gravity on (set to off by default) with the 'force' and 'force3' layouts. When gravity is turned on, plotting a graph with multiple components attracts all of the nodes to the origin and enables large components to take up more space.

  • 'Center' name-value pair — To specify a single node that should appear in the center of a circular graph plot with the 'circle' layout.

polyshape Objects: Analyze polygons with turningdist, nearestvertex, and overlaps functions

New functionality for analyzing 2-D polygons is available for polyshape objects:

  • turningdist function returns a number close to 0 when two input polyshape objects have nearly matching boundary shapes, regardless of scale or orientation.

  • nearestvertex function returns the closest vertex of an input polyshape object to a query point.

  • overlaps function determines if two polyshape objects are overlapping.

polyshape Objects: Return vertex map and accept arrays with compatible sizes for intersect, subtract, union, and xor functions

The intersect, subtract, union, and xor functions for polyshape objects now return vertex mapping information and accept input arrays of polyshape objects with compatible sizes.

Vertex mapping enables you to identify where the vertices of an output polyshape originated. For example, [pout,pshapeID,vertexID] = intersect(pshape1,pshape2) returns column vectors pshapeID and vertexID containing the same number of rows as the number of vertices in pout.

Each element of shapeID contains the value 1, 2, or 0:

  • Element is 1 when the corresponding vertices of pout belong to pshape1.

  • Element is 2 when the corresponding vertices of pout belong to pshape2.

  • Element is 0 when the corresponding vertices of pout belong to the intersection of pshape1 and pshape2.

The vertex information vertexID contains the row numbers for the corresponding vertices in pshape1 and pshape2.

polybuffer Function: Create buffer around points or lines

The polybuffer function enables you to specify a buffer around a set of points or line segments. For example, pshape = polybuffer([0 0; 2 3],'Points',1) creates a polyshape object pshape whose boundaries are circles of radius 1 centered about the points (0,0) and (2,3).

triangulation Objects: Find neighboring vertices and locations of query points with improved performance

You can compute neighboring vertices and locations of query points faster with the nearestNeighbor and pointLocation functions for triangulation objects.

ode45 Function: Solve nonstiff differential equations faster

The ode45 function shows improved performance for some problems.

Graphics

Axes Object: View axes at small size with improved layout, limit selection, and font scaling

Small axes have an improved layout that reduces white space for better readability. To reduce white space, the axes limits now fit more tightly around the data. Also, legends and colorbars have narrower margins. Additionally, the font size scales down slightly for small axes to avoid overlapping text or text that runs off the figure.

Compatibility Considerations

For small axes, you might encounter slightly different limits, tick values, or font sizes than in previous releases. However, if you previously specified the limits, tick values, or font size, then the axes still uses the values that you specify. To specify the limits, use the xlim and ylim functions. To specify the tick values, use the xticks and yticks functions. To specify the font size, use the FontSize property.

Axes Object: Map data values to colormap using linear or logarithmic scale

Scale colormaps linearly or logarithmically using the new ColorScale property for Axes objects.

Legend Object: Create legends with multiple columns

You can create legends with multiple columns using the new NumColumns property for Legend objects. For an example, see Add Legend to Graph.

heatmap Function: Zoom and pan data, display data tips, and sort rows and columns interactively

Heatmaps have new options for interacting with data:

  • Zoom — Use the scroll wheel or the + and - keys to zoom.

  • Pan — Use the arrow keys to pan across the rows or columns.

  • Data tips — Hover over the heatmap to display a data tip.

  • Rearrange rows and columns — Click and drag a row or column label to move it to a different position.

  • Sort values — Click the icon that appears when you hover over the row or column label. Click once to sort the values in ascending order, twice to sort the values in descending order, and a third time to reset the order.

geobubble Function: Explore with interactive data tips and a scale bar​ ​

Geographic bubble charts now support data tips. Hover over a bubble on the chart to display a data tip.

In addition, geographic bubble charts now include a scale bar in their lower left corner to indicate the actual distances represented in the map. Use the ScalebarVisible property to control whether your chart includes a scale bar.

Axes Toolbar: Add toolbars to your axes for quick access to pan, zoom, and other data exploration tools

You can add a toolbar to the top-right corner of the axes for quick access to data exploration tools. The toolbar typically includes options to brush data, add data tips, rotate (3-D axes only), pan, and zoom.

To add the toolbar, use the new Toolbar property for Axes objects. The Toolbar property stores an AxesToolbar object. Set the Visible property of the AxesToolbar object to 'on'. Some of the axes toolbar options are redundant with the figure toolbar. You can remove the redundant options from the figure toolbar using the removeToolbarExplorationButtons command.

ax = gca;
ax.Toolbar.Visible = 'on';
removeToolbarExplorationButtons(gcf);

To restore the figure toolbar exploration buttons, use the addToolbarExplorationButtons(gcf) command.

Property Inspector: Modify graphics interactively with an improved property inspector

An improved Property Inspector makes it easier to modify graphics objects interactively. To open the inspector, use the inspect function. For example, inspect(gca) opens the inspector for the current axes.

Polygon Object: Control color and transparency of hole edges

You can control the color and transparency of the polygon hole boundaries. Use the new HoleEdgeColor and HoleEdgeAlpha properties for Polygon objects.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

Changing the figure colormap affects all axes in the figure

Still runs

Not applicable

When you change a figure’s colormap, the colormap changes for all axes in the figure. Previously, if you specified the colormap for a particular axes, then changing the figure’s colormap did not affect the axes.

Set the axes colormap after setting the figure colormap to avoid the figure’s colormap overwriting the axes colormap.

Axes limits, tick values, or font sizes for small axes might be different Still runsNot applicable

Due to an improved layout that reduces white space, small axes might have slightly different limits, tick values, or font sizes than in previous releases.

If you prefer the limits, tick values, or font sizes from previous releases, you can manually set them. To specify the limits, use the xlim and ylim functions. To specify the tick values, use the xticks and yticks functions. To specify the font size, use the FontSize property.

Setting title properties of geographic bubble chart to empty ([]) array Still runsNot applicable

GeographicBubbleChart objects now store empty title properties as an 0-by-0 empty character array. The title properties include the Title, SizeLegendTitle, and ColorLegendTitle properties.

Previously, setting the property to an empty array either returned an error or stored the value with unexpected dimensions (as a 0-by-0-by-0 empty character array).

Setting title properties of geographic bubble chart to multiline titleStill runsNot applicable

GeographicBubbleChart objects now store multiline titles as a cell array of character vectors. The title properties include the Title, SizeLegendTitle, and ColorLegendTitle properties.

Previously, the chart stored the value as a character matrix and displayed the title with incorrect alignment.

Data Import and Export

readtable Function: Specify the number of rows to read from a text file using import options

You can select a subset of rows to read from a text file using readtable along with import options. Use the DataLines property to specify the rows to read. Specify DataLines in multiple ways:

  • opts.DataLines = 5 sets the DataLines property to the value [5 inf]. The readtable function reads all rows of data starting from row 5 to the end-of-file.

  • opts.DataLines = [2 6] sets the property to read lines 2 through 6. The readtable function reads all rows of data starting from row 2 to row 6.

  • opts.DataLines = [1 3; 5 6; 8 inf] sets the property to read rows 1, 2, 3, 5, 6, and all rows between 8 and the end-of-file.

After specifying DataLines, import the data using readtable:

T = readtable(filename,opts);
For more information, see the DataLines property of DelimitedTextImportOptions and FixedWidthImportOptions objects.

readtable Function: Easily manage prefixes and suffixes from data using import options

You can specify characters to remove from the prefix and suffix positions in a variable using readtable with import options. Specify the prefix and suffix options in multiple ways:

  • opts = setvaropts(opts,'Var1','Prefixes','$') sets the Prefixes option for the variable Var1. If Var1 contains a value of '$500', then readtable reads it as '500'.

  • opts = setvaropts(opts,'Var1','Suffixes','/-') sets the Suffixes option for the variable Var1. If Var1 contains a value of '$500/-' , then readtable reads it as '$500'.

  • opts = setvaropts(opts,'Var1','TrimNonNumeric',true) sets the TrimNonNumeric option for variable Var1. If Var1 contains a value of '$500/-', then readtable reads it as 500.

For more information, see the variable options and descriptions on the setvaropts reference page.

preview Function: Preview first 8 rows of a table in a file without importing the full table

You can preview the first 8 rows of a table from a file before importing the full table using readtable and import options. For more information, see the preview function.

imageDatastore Function: Work with millions of images with improved memory usage and performance

The imageDatastore function now supports faster processing of millions of images for deep learning applications with improved memory usage.

Datastore Functions: Seamlessly work with datasets stored on cloud and local machines

You can work with datasets stored on cloud and local machines by using the 'AlternateFileSystemRoots' parameter in datastore functions and the File-set object for custom datastores. This parameter is supported for:

For more information, see Set Up Datastore for Processing on Different Machines or Clusters.

Datastore Functions: Read HDFS data more easily when using Hortonworks or Cloudera

You can use datastore functions to access HDFS™ data more easily on Hortonworks or Cloudera® without having to set the HADOOP_HOME or HADOOP_PREFIX environment variables. MATLAB now automatically assigns these environment variables when using Hortonworks or Cloudera application edge nodes.

For more information, see Read Remote Data.

readtable, detectImportOptions, datastore, and tabularTextDatastore Functions: Automatically detect and return duration data in text files

The functions readtable, detectImportOptions, datastore, and tabularTextDatastore detect and return duration data as duration type. For more information on duration arrays, see the duration reference page.

Compatibility Considerations

Previously, readtable, detectImportOptions, datastore, and tabularTextDatastore functions returned duration data as text. To preserve that behavior, use the DurationType parameter. For example, T = readtable('myfile.txt','DurationType','text') reads duration data in myfile.txt as text. For more information on the DurationType parameter, see the function reference pages.

detectImportOptions Function: Control import properties of duration data

The detectImportOptions now can detect and manage variables of type duration in tabular data.

For a variable in a table containing duration data, you can use the setvaropts function to set these properties: DurationFormat, InputFormat, DecimalSeparator, and FieldSeparator. For more information, see the setvaropts function page.

VideoReader Function: Read video files faster on all platforms

VideoReader has improved performance for all supported video formats when you read video frames in a loop as part of a general video processing workflow. For more information on supported video formats and function usage, see VideoReader.

VideoWriter Function: Write video files faster on all platforms

VideoWriter has improved performance for all supported video formats, when you write video frames in a loop as part of a general video processing workflow. For more information on supported video formats and function usage, see VideoWriter.

openDiskFile Function: Read data files in FITS (Flexible Image Transport System) data format

Read data files in FITS (Flexible Image Transport System) data format using the openDiskFile function.

webwrite Function: Support for NTLM authentication

The webwrite function and weboptions POST and PUT methods support NTLM authentication on Windows® platforms.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

DataLine property of DelimitedTextImportOptions and FixedWidthImportOptions objects

Still runs

DataLines

Use property name DataLines instead of DataLine.
readall method for SpreadsheetDatastore, TabularTextDatastore, KeyValueDatastore, and TallDatastore objectsStill runsNot applicable

The readall(ds) method no longer resets the datastore ds to a state where no data has been read from it. This new behavior of readall enables the read method to read data from the end of the previous read operation.

Previously, readall(ds) would reset the datastore specified by ds to the state where no data has been read from it. Therefore, any call to read after a readall would always read from the beginning of the datastore.

Output from sheetnames functionStill runsNot applicable

The sheetnames function now returns the names argument as a string array.

Previously, sheetnames returned names as a cell array of character vectors. To convert names back to a cell array of character vectors, use the following:

% Get sheet names from a file 'myfile3.xls' 
% in the spreadsheetDatastore ssds
names = sheetnames(ssds,'myfile3.xls');
% Convert names to cell array of character vectors
names = cellstr(names); 

hdfgd

Errorsmatlab.io.hdfeos.gdReplace all instances of hdfgd with the corresponding function in the matlab.io.hdfeos.gd package.

hdfsd

Errors matlab.io.hdf4.sdReplace all instances of hdfsd with the corresponding function in the matlab.io.hdf4.sd package.

hdfsw

Errorsmatlab.io.hdfeos.swReplace all instances of hdfsw with the corresponding function in the matlab.io.hdfeos.sw package.

Data Analysis

groupsummary Function: Group and discretize data for summary operations on table and timetable variables

Grouping and discretizing table and timetable data for summary operations is now easier with the groupsummary function. For example, groupsummary(T,'Gender','method','mean') computes the mean of the variables in a table T by gender.

Table and Timetable Variables: Add, delete, and rearrange column-oriented variables with the functions addvars, removevars, movevars, splitvars, mergevars, rows2vars, and inner2outer

Function

Description

addvars

Add variables to table or timetable.

removevars

Delete variables from table or timetable.

movevars

Move variables in table or timetable.

splitvars

Split multicolumn variables in table or timetable.

mergevars

Combine table or timetable variables into multicolumn variable.

rows2vars

Reorient rows of table or timetable so that rows become variables.

inner2outer

Invert a nested table-in-table hierarchy.

Preallocated Tables and Timetables: Initialize table and timetable variables so that they have specified sizes and data types

To initialize table and timetable variables so that they have specified sizes and data types, specify the 'Size' and 'VariableTypes' name-value pair arguments of the table and timetable functions. You can specify the number of rows, the number of variables, and the data types of the variables. The preallocated variables contain default values or empty arrays, depending on the specified data types. You can fill the variables with data values later.

Regular Timetables: Create regularly spaced timetables using a time step or sampling rate

You can create regular timetables using either a time step or a sampling rate to specify identical time intervals between consecutive row times. To create regular timetables, use the timetable or array2timetable functions with the 'TimeStep' or 'SamplingRate' name-value pair arguments. You also can specify the value of the first row time using the 'StartTime' name-value pair.

retime and synchronize Functions: Synchronize timetables to a time step or sampling rate that you specify

To synchronize timetables to a time step or sampling rate, use the 'TimeStep' or 'SamplingRate' name-value pair arguments of the retime or synchronize functions.

duration Arrays: Create duration arrays from text that represents elapsed times

You can convert text representing elapsed times into a duration array using the duration function. The input text represents each time in a format such as 'hh:mm:ss' or 'dd:hh:mm:ss'. The fields dd, hh, mm, and ss represent days, hours, minutes, and seconds, respectively.

normalize Function: Normalize array, table, and timetable data

You can normalize data in an array, table, or timetable by quantities such as the z-score or p-norm using the normalize function. For example, normalize(A,'norm',1) normalizes each column of a matrix A by its 1-norm.

tall Arrays: Operate on tall arrays with more functions, including smoothdata, find, and isoutlier

The functions listed in this table add support for tall arrays as inputs. For a complete list of supported functions, type methods tall. For more information on usage and limitations, type help tall/functionName. For example, help tall/find.

tall Array Indexing: Use tall numeric arrays to index the first dimension

For a tall array X, you can index the first dimension of the array with X(idx,…), where idx is a tall numeric array.

tall Arrays: Solve linear systems Ax = b

You can solve linear systems Ax = b with a tall coefficient matrix A by x = A\b. The solver for tall arrays uses a QR decomposition to find a least-squares solution to the problem.

tall Arrays: Return group labels with findgroups

findgroups now supports multiple output arguments with tall arrays. The additional outputs from findgroups contain unique lists of group labels for each grouping variable.

tall Arrays: Set date and time components of tall datetime and tall duration arrays

You can change the properties of tall datetime and tall duration arrays using dot indexing. For example, t.Format = 'dd-MMM-yyyy' changes the display format of t.

See the datetime and duration pages for a list of the properties, or Extract or Assign Date and Time Components of Datetime Array for examples.

tall Arrays: Set properties of tall tables and tall timetables

You can change the properties of tall tables and tall timetables using dot indexing. For example, T.Properties.VariableNames = {'Name1' 'Name2'} changes the variable names of T. For a list of all properties use the command T.Properties.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

Adding and subtracting durations represented as text in timer format from a datetime array

Still runs

Not applicable

Starting in R2018a, if you represent a duration as text, you can add and subtract it from a datetime array, and the result is a datetime array. In both operations, text in timer format is converted to a duration value. For example, this code adds 1 hour and 30 minutes to the current date and time.

datetime('now') + '1:30:00'

This code subtracts 12 hours from the current date and time.

datetime('now') - '12:00:00'

Previously, if you represented a duration as text in a timer format, such as '1:30:00', then adding that duration to a datetime array raised an error, while subtracting it returned a duration array, instead of a datetime array.

To reproduce the earlier behavior, convert the text to a datetime value. Subtracting a datetime array from another datetime array returns a duration array.

datetime('now') - datetime('12:00:00')

Naming the row times vector of a timetable when you specify the 'VariableNames' name-value pair argument of the timetable function

Still runs

Not applicable

Starting in R2017b, the timetable function assigns the name of the input time vector as the name of the row times vector, even when you specify variable names using the 'VariableNames' name-value pair argument. Previously in R2016b and R2017a, timetable assigned 'Time' as the name of the row times vector when you specified 'VariableNames'. This behavior changed because the row times vector is not a timetable variable. The row times are the labels of the rows.

To rename the row times vector, use the DimensionNames property. For example, TT.Properties.DimensionNames{1} = 'Time' changes the name of the row times vector of TT to 'Time'.

Subscripting into a timetable using datetime or duration values as row subscripts

Still runs

Not applicable

Starting in R2018a, timetable subscripting uses a tolerance to match subscripts to row times. Therefore, one subscript might match two or more distinct row times in a timetable when those row times differ only by a small amount. Previously in R2016b through R2017b, you could access data in a timetable using a datetime or duration array as the row subscript, but subscripting required an exact match between a time in the subscripts and a row time of the timetable.

You can reproduce the earlier behavior that required an exact match in several ways. To select only exact matches at a single time, create a logical row subscript by testing for equality between subscripts and the row times using the equality operator, ==. To select only exact matches at multiple times, create a logical row subscript using the ismember function. As an alternative, use the withtol function with a tolerance of seconds(0).

App Building

App Designer: Create deployed web apps using MATLAB Compiler

If you have MATLAB Compiler™ installed on your system, you can create web apps using the Share button in the App Designer toolstrip. For more information, see Ways to Share Apps.

Google Chrome™ and Internet Explorer® (version 11 and later) support running web apps.

App Designer: Add and configure tree components on the App Designer canvas

Drag and drop tree components from the Component Library onto the canvas, and change their text labels and positions directly in the canvas.

App Designer: Select from recently used argument sets when running apps with input arguments

Configure up to seven sets of input arguments under the Run button in the App Designer toolstrip. Select any of the sets to run them again. The sets remain in the drop-down list until you close the app.

App Designer: Edit axes title and label directly in the canvas

Now you can modify plot titles and axes labels more quickly by editing them directly on the canvas.

GUIDE: Migrate GUIDE apps to App Designer

For assistance in migrating your apps to App Designer, use the GUIDE to App Designer Migration Tool for MATLAB. This tool is available as a support package.

App Testing Framework: Author automated tests for App Designer apps

Use the app testing framework to write automated tests for your apps. The app testing framework leverages the MATLAB unit testing framework.

You can use the MATLAB app testing framework to test apps built with App Designer or apps built programmatically using the uifigure function. The app testing framework enables you to author a test class that programmatically performs a gesture on a UI component, such as pressing a button or dragging a slider, and verifies the behavior of the app.

For more information, see App Testing Framework.

Figure Objects: Maximize and minimize figures programmatically

Use the WindowState property to maximize, minimize, or display a figure in full-screen mode.

uitable Function: Specify data as table array

The Data property of Table UI components now accepts table arrays. For example:

T = readtable('patients.xls');
uit = uitable(uifigure,'Data',T);

table arrays are supported only in App Designer apps or figures created with the uifigure function.

uidatepicker Function: Add date selection controls to apps

Call the uidatepicker function to add a date picker to an app.

To display a date picker in an App Designer app, call the uidatepicker function from within a callback, such as the StartupFcn for the UIFigure component.

Date pickers work only in App Designer apps or in figures created with the uifigure function.

uiprogressdlg Function: Create modal in-app progress dialog boxes to apps

Call the uiprogressdlg function to create a progress dialog box within an app.

The dialog box can only display in App Designer apps or in figures created with the uifigure function.

uitree Function: Create trees with editable node text in the running app

Specify the Editable property of a tree so that users can change the node text while the app is running. Specify the NodeTextChangedFcn callback to make the app respond when the user changes node text.

Component Text Alignment: Improved text alignment for labels, check boxes, and radio buttons

The default height and vertical alignment for labels, check boxes, and radio buttons are now consistent with other single-line, text-based components. The new values make it easier to align the text of these components with other components.

Only labels, check boxes, and radio buttons in App Designer and in figures created with the uifigure function are affected.

Compatibility Considerations

The new default height for these components is 22 pixels (previously, it was 15 pixels). Text is now centered vertically within the component’s text box (previously, text was aligned to the top of the text box).

The labels, check boxes, and radio buttons in apps created in previous releases might look different when you open or run them in R2018a.You might need to change the vertical alignment, or adjust the height and location of those components to maintain a consistent appearance.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

Apps saved in App Designer using R2018a

Error (when opening in previous releases)

Select Save > Save Copy As in the R2018a App Designer toolstrip.

The .mlapp file format changed in R2018a. Apps created or modified in App Designer return an error when you try to open them in previous releases. To modify an app across multiple releases, select Save > Save Copy As in the R2018a App Designer toolstrip. Then select the appropriate MATLAB release from the Save as type drop-down list. Alternatively, make a backup copy of the app before opening the app in R2018a.

Apps created in previous releases that contain labels, check boxes, or radio buttons

Still Runs

Not applicable

The new default height and vertical alignment of text for labels, check boxes, and radio buttons has changed. You might need to change the vertical alignment, or adjust the height and location of those components to maintain a consistent appearance. For more information, see Component Text Alignment: Improved text alignment for labels, check boxes, and radio buttons.

Performance

Startup: Increased speed of MATLAB startup time

MATLAB starts faster because of infrastructure improvements and optimizations.

Execution Engine: Execute tight loops with scalar math faster

Loops that contain mainly indexing and scalar math operations execute faster due to execution engine optimizations.

Execution Engine: Improved performance for common programming patterns

Common programming patterns, such as the evaluation of anonymous functions, and common combinations of operations, such as isequal(size(x),size(y)), execute faster due to targeted optimizations.

App Designer: Starting, loading, and layout tasks are faster

Starting App Designer is 40% faster than in R2017b. Loading apps and performing layout tasks in App Designer are 10% to 30% faster than in R2017b.

Hardware Support

Raspberry Pi: Support for Raspberry Pi Zero W board

You can now use the MATLAB Support Package for Raspberry Pi™ Hardware with the Raspberry Pi Zero W board.

MATLAB Support Package for Raspberry Pi Hardware enables you to communicate with Raspberry Pi Zero W using Wi-Fi® or a micro-USB cable connection. For more information on how to communicate with Raspberry Pi Zero W, follow the steps in Install, Update, or Uninstall Support Package (MATLAB Support Package for Raspberry Pi Hardware).

MATLAB Online: Acquire live images from USB webcams in MATLAB Online

You now can connect to and stream images from your USB webcam in MATLAB Online™. Connect a USB webcam to your computer and give your browser access to your camera. All the functions in the MATLAB Support Package for USB Webcams are available for MATLAB Online.

Advanced Software Development

Tab Completion: Describe your function syntaxes for custom tab completion and other contextual suggestions

To customize code suggestions and completions for your functions, provide MATLAB with a JSON-formatted file that contains information about your function signatures. MATLAB uses this information to improve interactive features, such as tab completion and function hints. For more information, see Customize Code Suggestions and Completions.

Unit Testing Framework: Run tests from the MATLAB Editor toolstrip

You can run tests from the MATLAB Editor toolstrip. When you open a function-based or class-based test file, the Editor toolstrip has options to run all tests in the file or to run a single test in the file. Also, you can customize the test run with options, such as running tests in parallel (which requires Parallel Computing Toolbox™) or running tests with a specified level of output detail.

The Run Tests controls in the toolstrip provide an alternative to programmatically running tests with the runtests function. For more information, see Run Tests in Editor.

App Testing Framework: Author automated tests for App Designer apps

Use the app testing framework to write automated tests for your apps. The app testing framework leverages the MATLAB unit testing framework.

You can use the MATLAB app testing framework to test apps built with App Designer or apps built programmatically using the uifigure function. The app testing framework enables you to author a test class that programmatically performs a gesture on a UI component, such as pressing a button or dragging a slider, and verifies the behavior of the app.

For more information, see App Testing Framework.

Unit Testing Framework: Rerun failed tests with one click

If a test failure is caused by incorrect or incomplete code for a test or for the code under test, it is useful to be able to rerun failed tests quickly and conveniently. If test failures exist in your test results, then MATLAB displays a link to rerun failed tests after it displays the number of failed tests.

Totals:
   1 Passed, 1 Failed (rerun), 0 Incomplete.
   0.25382 seconds testing time.

For more information, see Rerun Failed Tests.

Unit Testing Framework: Test if values point to existing files or folders with IsFile and IsFolder constraints

You can test if a value, specified as a string scalar or character vector, points to an existing file or folder.

  • To test if a value points to an existing file, use verifyThat, assertThat, assumeThat, or fatalAssertThat with the IsFile constraint. For more information, see matlab.unittest.constraints.IsFile.

  • To test if a value points to an existing folder, use verifyThat, assertThat, assumeThat, or fatalAssertThat with the IsFolder constraint. For more information, see matlab.unittest.constraints.IsFolder.

Unit Testing Framework: Test if two sets are the same with IsSameSetAs constraint

To test if two sets are the same, use the IsSameSetAs constraint. The testing framework considers tests to be the same if they contain the same elements. Sets can be the same even if they have different order, shape, and size. For example, if S = {'a' 'b' 'c'}, then set S is the same as the following sets.

S1 = {'a' 'b' 'c'};
S2 = {'c';'a';'b'};
S3 = {'a' 'b' 'c' 'c' 'b'};

For more information, see matlab.unittest.constraints.IsSameSetAs.

Unit Testing Framework: Select tests by test class hierarchy

You can run tests that have a specified superclass:

Compatibility Considerations

Test suite elements created prior to MATLAB R2018a cannot be filtered by test class hierarchy. To filter these test elements by superclass, recreate the test suite in R2018a or later.

Unit Testing Framework: Direct output stream to unique files for plugins

To direct text output from plugins to a unique file, use the matlab.unittest.plugins.ToUniqueFile output stream. This output stream is useful for running tests in parallel while redirecting output to a file, since it uses a unique file name for each instance of the output stream. The ToUniqueFile output stream is different from the ToFile output stream, which overwrites the file. For more information, see matlab.unittest.plugins.ToUniqueFile.

The ToUniqueFile output stream is supported for

Additionally, the matlab.unittest.plugins.OutputStream class provides an interface for test authors to create custom output streams.

Unit Testing Framework: Increased access to parameterized testing properties

When you create a parameterized test, you define properties in a properties block with a TestParameter, MethodSetupParameter, or ClassSetupParameter attribute, depending on the parameterization level for your test. You can now access “up-level” parameters.

  • Tests in a Test method block can access parameters that you define in TestParameter, MethodSetupParameter, and ClassSetupParameter properties blocks.

  • Tests in a TestMethodSetup method block can access parameters that you define in MethodSetupParameter and ClassSetupParameter properties blocks.

  • Tests in a TestClassSetup method block can access parameters that you define in a ClassSetupParameter properties block.

In previous versions of MATLAB, you could access only parameters from tests in method blocks at the corresponding level. For example, parameters defined in a MethodSetupParameter property block were only accessible from tests in a TestMethodSetup method block. For more information, see Create Advanced Parameterized Test.

Unit Testing Framework: Compare cell arrays of character arrays using StringComparator

In addition to supporting strings and character arrays, the StringComparator constraint now supports cell arrays of character arrays. For more information, see matlab.unittest.constraints.StringComparator.

Compatibility Considerations

Update any tests that rely on the StringComparator constraint not being satisfied by equal cell arrays of character arrays. If the cell arrays of character arrays are equal, the comparator is satisfied. In previous versions of MATLAB, the comparator was not satisfied for any values that were cell arrays of character arrays. For example, the following test passes in MATLAB R2018a and later. In earlier versions of MATLAB, the test fails because the comparator did not support cell arrays of character arrays.

import matlab.unittest.TestCase
import matlab.unittest.constraints.StringComparator
import matlab.unittest.constraints.IsEqualTo
 
testCase = TestCase.forInteractiveUse;
actVal = {'coffee','cream','sugar'};
expVal = {'coffee','cream','sugar'};

testCase.verifyThat(actVal,IsEqualTo(expVal,'Using',StringComparator))

Unit Testing Framework: Comparison method for objects changed

As of R2018a, the ObjectComparator is satisfied if isequaln returns true. However, if the class of the expected value defines an isequal method, whether visible or hidden, but not an isequaln method, the ObjectComparator uses the isequal method for comparison. In previous releases, ObjectComparator used isequal to compare all objects unless the class of the expected value defined a visible isequaln method.

The IsEqualTo constraint and the assertEqual, assumeEqual, fatalAssertEqual, and verifyEqual qualification methods leverage ObjectComparator and, therefore, inherit the same change in behavior. For more information, see matlab.unittest.constraints.ObjectComparator.

Compatibility Considerations

The ObjectComparator now uses isequaln for comparison instead of isequal if the class of the expected value

  • Defines isequaln, whether visible or hidden.

  • Does not define either isequal or isequaln.

Performance Testing Framework: Define multiple, labeled measurement boundaries in test methods

Measurement boundaries enable you to refine which code the performance framework measures, and now you can label the measurement boundaries. Measurements from multiple boundaries with the same label in the same test method are accumulated and summed. The performance framework appends the label is to the test element name in the measurement results. For more information, see startMeasuring.

Mocking Framework: Specify default property values on mock object

When you create a mock object for a class, you can specify default values for properties that are implemented by the class. To specify default property values, use the DefaultPropertyValues name-value pair argument with the createMock method. For more information, see matlab.mock.TestCase.createMock.

Mocking Framework: Obtain interaction history for mock object

To obtain a history of recorded interactions for a mock object, use either the matlab.mock.TestCase.getMockHistory method or the matlab.mock.InteractionHistory.forMock method. When you call certain publicly visible methods or access or modify certain publicly visible properties on a mocked class, the mocking framework records the interaction. For more information, see matlab.mock.TestCase.getMockHistory or matlab.mock.InteractionHistory.forMock.

Mocking Framework: Construct mocks for classes that have Abstract properties with other attributes

You can construct a mock object for classes that have Abstract properties and other attributes. For example, you can construct a mock for a property that has Abstract and Constant attributes. The mock implements the property as a concrete, Constant property. Similarly, properties with Abstract and Hidden attributes are implemented as concrete and Hidden properties. For more information, see Create Mock Object.

matlab.net.http Package: Stream data to and from a web service and handle forms and multipart messages

To act on or display streamed data while it is being received, use the matlab.net.http.io.ContentConsumer class. To obtain or generate the data at the same time it is being sent, use the matlab.net.http.io.ContentProvider class. Using this class avoids the need to have all the data in memory before the start of a message,.

To handle forms and multipart messages, use the matlab.net.http.io.MultipartConsumer and matlab.net.http.io.MultipartProvider classes.

The following classes and methods were added to the matlab.net.http and matlab.net.http.field packages.

C++ MEX Interface: Access MATLAB data and objects easier from C++

Author MEX functions using modern C++ design patterns, extended data type support, and MATLAB copy-on-write semantics for faster handling of large data arrays. For more information, see C++ MEX Applications.

If you do not need MEX files that work in R2017b and earlier and you are familiar with modern C++, then consider using the new C++ MEX API and MATLAB Data API. If you are more comfortable working in the C language, continue using the C MEX API and C Matrix API.

Class Constructors: Author subclass without implementing a constructor solely to pass arguments through to a superclass constructor

MATLAB passes arguments implicitly from a default subclass constructor to the superclass constructor. This behavior eliminates the need to implement a constructor method for a subclass only to pass arguments to the superclass constructor. For more information, see Implicit Call to Inherited Constructor.

Property Validation: Get information about property validation

Get information on the validation defined for a property by accessing the validation metadata for that property. For more information, see Metadata Interface to Property Validation.

Property Validation: Define validation for abstract properties

As of MATLAB Version 9.4 (R2018a), you can define validation for abstract properties. The validation applies to all subclasses. For more information, see Abstract Property Validation.

Functions: Call numArgumentsFromSubscript for object dot method from overloaded subsref

In releases prior to MATLAB Version 9.4 (R2018a), the built-in numArgumentsFromSubscript function handled method calls of the form object.method incorrectly.

In releases prior to MATLAB Version 9.4 (R2018a), when a class overloaded subsref and numArgumentsFromSubscript and a user called an indexed expression of the form object.method(), MATLAB called subsref with 0 outputs without calling numArgumentsFromSubscript.

If instead the user called object.method (with no parentheses), then MATLAB treated this expression as a dot-reference and called numArgumentsFromSubscript. If an overloaded numArgumentsFromSubscript called the built-in version of the function, MATLAB returned 1 for the object.method expression. This caused errors when calling methods that return no outputs, and created differences in behavior between object.method() and object.method.

With MATLAB Version 9.4 (R2018a), when a method is called through a dot-indexing expression on the right-hand side, the built-in numArgumentsFromSubscript returns 0. Because of this change, MATLAB calls subsref with zero outputs in both the object.method() and object.method cases.

Compatibility Considerations

Changed behavior can occur for cases in which classes overload numArgumentsFromSubscript and the method calls the built-in function for indexing expressions that end in dot-method (object.method) references.

Classes: Concatenate matlab.lang.OnOffSwitchState enumeration members with nonmember char and string

With the release of MATLAB Version 9.4 (R2018a), the matlab.lang.OnOffSwitchState class supports special concatenation behavior to enable the formation of text expressions by concatenating enumeration members with character vectors or strings. For more information, see matlab.lang.OnOffSwitchState.

Compatibility Considerations

In releases prior to MATLAB Version 9.4 (R2018a), arrays containing matlab.lang.OnOffSwitchState enumeration members and character vector or string elements required that all array elements be convertible to enumeration members (that is, on, off, true, false, 1, or 0). The resulting array was of type matlab.lang.OnOffSwitchState. With the release of MATLAB Version 9.4 (R2018a), concatenation rules enable concatenation with character vectors or strings that do not map to enumeration members. For more information, see Concatenation Rules for OnOffSwitchState.

Python Version 3.4: Support discontinued

Support for Python® version 3.4 is discontinued.

Compatibility Considerations

To ensure continued support for your applications, upgrade to a supported version of Python—version 3.5 or 3.6.

Source Control Integration: View changes, save revisions, and manage repository locks

When you are using SVN source control, the SVN file revisions history now shows a tree view of change set files that has a context menu. You can select a particular file revision and view changes or save revisions. For more information, see Review Changes in Source Control.

You can now monitor and break SVN locks. The SVN Repository Locks dialog box supports SVN locking workflows within teams:

  • Determine who has a lock

  • Break locks

  • Group locks by user or file

For details, see Get SVN File Locks.

MATLAB Engine API for C++: Set and get a property value on an object in an object array

With release R2018a, C++ Engine applications can call the matlab::engine::MATLABEngine getProperty, getPropertyAsync, setProperty, and setPropertyAsync member functions with object array inputs and pass an array index to access scalar objects within the array. In previous releases, C++ Engine applications could access object properties only from scalar object variables. For more information, see Pass Variables from MATLAB to C++.

MATLAB Data API: Applications built with R2018a API do not run in MATLAB R2017b

Applications using the MATLAB Data API built in R2018a are not supported in MATLAB R2017b.

Compatibility Considerations

Applications built in MATLAB R2018a run only in MATLAB R2018a. For more information, see Version Compatibility.

MEX Functions: Build C MEX Files with Interleaved Complex API

As of MATLAB Version 9.4 (R2018a), MATLAB uses an interleaved storage representation of complex numbers. The term Interleaved complex refers to this representation, where the real and imaginary parts are stored together. For more information, see MATLAB Support for Interleaved Complex API in C MEX Functions.

This change does not affect the MATLAB language. You can continue to use the functionality described in Complex Numbers without any modification of your functions and scripts.

Compatibility Considerations

If you build C MEX functions, C/C++ MEX S-functions, or standalone MATLAB engine and MAT-file applications, then you should review the Do I Need to Upgrade My MEX Files to Use Interleaved Complex API? topic. MATLAB does not support the interleaved complex API for Fortran functions.

The functionality for mxGetPr (C), mxSetPr (C), mxGetPi (C), mxSetPi (C), mxGetData (C), mxSetData (C), mxGetImagData (C), mxSetImagData (C), and mxGetElementSize (C) has changed. For more information, see Functionality being removed or changed.

MEX Functions: Release-specific build options

The mex command has new build options, -R2017b and -R2018a, which link with release-specific versions of the C Matrix API.

Version Embedded in MEX Files

The mex command embeds a MEX version number in MEX files built by MATLAB R2016b and later. This number identifies the version of the Matrix API that the MEX function expects to link against at runtime.

Compatibility Considerations

If you do not use the mex command to build your MEX files, then you must update the commands you use to build MEX files. For more information, see https://www.mathworks.com/matlabcentral/answers/377799-compiling-mex-files-without-the-mex-command.

Perl 5.26.1: MATLAB support

MATLAB ships with Perl version 5.26.1.

Compatibility Considerations

If you use the perl command on Windows platforms, see www.perl.org for information about using this version of the Perl programming language.

System objects: Create System Objects in MATLAB

System objects are a specialized kind of MATLAB object that allow you to easily implement and simulate dynamic systems. You can use predefined System objects shipped with many System Toolboxes. You can also create your own System objects in the MATLAB editor. For more information, see Define Basic System Objects.

When you create System objects in R2018a, by default, users of that System object can change characteristics of inputs, discrete states, tunable properties from call to call. New and updated methods allow you to restrict these characteristics:

Characteristic That Can ChangeMethods to Restrict Characteristic

number of inputs

getNumInputsImpl

number of outputs

getNumOutputsImpl

input size

isInputSizeMutableImpl

input data-type

isInputDataTypeMutableImpl

input complexity

isInputComplexityMutableImpl

discrete state data-types

isDiscreteStateSpecificationMutableImpl

tunable property data-types

isTunablePropertyDataTypeMutableImpl

For more information, see System Objects.

Compatibility Considerations

If you want to retain strict rules for inputs, tunable properties, and discrete states, use the sysobjupdate function to update code in existing System objects. For more information, type help sysobjupdate at the MATLAB command line.

The isInputSizeLocked method will be removed in a future release. Use isInputSizeMutableImpl instead.

System object support for strings

System objects accept strings as inputs for text input and property values.

When authoring a System object, you can use strings to define a StringSet property. However, the default value of a StringSet property must be defined as a character vector.

.NET: Supports string data type

When calling a .NET method or function, MATLAB converts string scalar arguments to a .NET System.String object and string array arguments to System.String[]. For more information, see Pass Data to .NET Objects.

The MATLAB string function converts System.String scalar arguments to a string scalar. The function converts String.String[], String.String[,], and so on, to MATLAB string arrays with the same dimensions and sizes. Conversion of jagged arrays, for example String.String[][], is not supported. For more information, see Handle Data Returned from .NET Objects.

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

SupportCompilerPlatform

Added

GNU® gcc and gfortran version 6.x. Version 6.3 recommended.

Linux®

Discontinued

GNU gcc and gfortran version 4.9.x

Linux

Discontinued

Apple Xcode 7.x

macOS

Discontinued

Intel® C++ Composer XE 2013

Windows

Discontinued

Intel Visual Fortran Composer XE 2013

Windows

Discontinued

Intel Fortran Composer XE 2013

macOS

To be phased out

Visual C++® 2013 Professional

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 Supported and Compatible Compilers.

Functionality being removed or changed

FunctionalityResultUse This InsteadCompatibility Considerations

Programmatic dependence on specific diagnostic subclass from getDiagnosticFor method of constraint and tolerances

Warns

Not applicable

Rework code that relies on properties or methods specific to matlab.unittest.diagnostic.ConstraintDiagnostic instances returned from the getDiagnosticFor method of matlab.unittest.constraints classes.

In a future release, diagnostics returned from constraint and tolerance classes in the matlab.unittest.constraints package will be subclasses of matlab.unittest.diagnostics.Diagnostic and might not be instances of matlab.unittest.diagnostic.ConstraintDiagnostic.

Negation of matlab.unittest.constraints.ReturnsTrue constraint (~ReturnsTrue)

Errors

Not applicable

Change the logic for tests that rely on negating the ReturnsTrue constraint.

mxGetPi and mxSetPi in C MEX functions built with the interleaved complex API (mex option -R2018a)

Errors

Use mxGetComplexDoubles instead of mxGetPr and mxGetPi.

MATLAB Support for Interleaved Complex API in C MEX Functions

mxGetImagData and mxSetImagData in C MEX functions built with the interleaved complex API (mex option -R2018a)

Errors

Typed Data Access functions

MATLAB Support for Interleaved Complex API in C MEX Functions

mxGetPr and mxSetPr in C MEX functions built with the interleaved complex API (mex option -R2018a)

Still runs when called for real mxArrays.

Errors when called for complex mxArrays.

Typed Data Access functions

MATLAB Support for Interleaved Complex API in C MEX Functions

mxGetData and mxSetData in C MEX functions built with the interleaved complex API (mex option -R2018a)

Still runsTyped Data Access functionsUse mxGetData (C) and mxSetData (C) for nonnumeric arrays only.

mxGetElementSize in C MEX functions built with the interleaved complex API (mex option -R2018a)

Still runs

Not applicable

mxGetElementSize (C)

mexSetTrapFlag in C and Fortran Matrix API

Errors

mexCallMATLABWithTrap

mexCallMATLABWithTrap lets you catch, or trap, errors.