MATLAB R2017a was released last week. Many of the changes reported in the release notes are evolutionary, building on and extending major new features introduced previously. For example, the Live Editor continues to gain expanded capabilities. In this post I pick out a few new features that caught my eye. This is very much a personal selection. For full details of what’s new, see the release notes, and see also my previous post What’s New in MATLAB R2016b if you are not familiar with R2016b.
Parula
The parula color map has been modified slightly. The difference is subtle, but as the following example illustrates, the R2017a parula is a bit more vibrant and has a bit less cyan and yellow in the blues and greens.
I note, however, that the difference between the old and the new parula is smaller when the images are converted to the CMYK color space, as they must be for printing.
Heatmap
The new heatmap
function plots a heatmap of tabular data. Although it is intended mainly for use with the table
data type, I think heatmap
will be useful for getting insight into the structure of matrices, as illustrated by the following examples.
String Arrays
String arrays, introduced in MATLAB R2016b, can now be formed using double quotes:
>> s = string('This is a string') % R2016b s = "This is a string" >> t = "This is a string" % R2017a t = "This is a string" >> isequal(s,t) ans = logical 1 >> whos Name Size Bytes Class Attributes s 1x1 166 string t 1x1 166 string
However, there is one major caveat. Many MATLAB functions that take a char as input argument have not yet been adapted to accept strings. Hence
>> A = gallery('moler',3) A = 1 -1 -1 -1 2 0 -1 0 3 >> A = gallery("moler",3) Error using nargin Argument must be either a character vector or a function handle. Error in gallery (line 191) nargs = nargin(matname);
I expect that such functions will be updated in future releases.
Missing
A new function missing
creates missing values appropriate to the data type in question.
>> A = ones(2); A(2,2) = missing A = 1 1 1 NaN > d = datetime('2014-05-26') d = datetime 26-May-2014 >> d(2) = missing d = 1×2 datetime array 26-May-2014 NaT
Until converted to the target datatype, a missing value has class missing
:
>> m = missing m = missing >> class(m) ans = 'missing'
Performance Improvements
The release notes report performance improvements under a variety of headings, including execution engine, scripts, and mathematics functions. These are very welcome, as the user automatically benefits from them. One comment that caught my eye is “The backslash command A\B is faster when operating on negative definite matrices”. I think this means that MATLAB checks whether the matrix, A, is symmetric with all negative diagonal elements and, if it is, attempts a Cholesky factorization of -A.