Desktop
Live Editor: Edit a figure interactively including title, labels, legend, and other annotations
In the Live Editor, you can add formatting and annotations to a figure interactively. To add an item go to the Figure tab and in the Annotations section, select from these available options:
[external_link_head]
-
Title
-
X-Label,
Y-Label
-
Legend
-
Colorbar
-
Grid,
X-Grid,
Y-Grid
-
Line,
Arrow,
Text Arrow,
Double Arrow
For more information, see Modify Figures in Live Scripts.
Live Editor: Get suggestions for mistyped commands and variables
MATLAB® suggests corrections for mistyped commands and variables in the Live Editor. If you enter an undefined command or variable name, MATLAB displays: Did you mean:
followed by a suggested command under the error message. Press the Fix button to replace the mistyped command with the suggested fix.
Live Editor: Copy live script outputs to other applications
When copying from the Live Editor to other applications, in line outputs within the selection are included along with the code and text. In applications that support only plain text, the code and text is copied, but outputs are not.
You also can copy an output by right-clicking the output and selecting a copy option from the context menu
Live Editor: Hover over variables to see their current value
You can view the current value of a variable as a data tip in the Live Editor. To view the data tip, position your mouse pointer over the variable.
Data tips are enabled by default in the Live Editor. To enable or disable data tips, with a live script open in the Live Editor, go to the View tab, and in the Display section, select or deselect Datatips.
Add-On Explorer: Discover and install File Exchange submissions hosted on GitHub in Add-On Explorer
File Exchange submissions hosted on GitHub® are now available in the Add-On Explorer. For more information on how to get add-ons through the Add-On Explorer, see Get Add-Ons.
MATLAB Online: Use MATLAB through your web browser for teaching, learning, and convenient, lightweight access
Complement your MATLAB experience with MATLAB Online™. For anytime, anywhere access, simply sign in with your MathWorks® account — no download or installation required.
MATLAB Online is available with most MATLAB licenses. For more information including eligibility, visit the MATLAB Online product page.
Startup Folder Behavior Changes: Set initial working folder using new options and behaviors
The options to set the initial working folder (startup folder) have changed. For more information, see MATLAB Startup Folder.
The behavior when starting MATLAB from a shortcut icon has changed. MATLAB starts from the last working folder, except on Linux® platforms or when the value is specified on Windows® platforms.
When calling MATLAB from a command prompt, the initial working folder is the terminal window folder. To use the initial working folder set in the general preferences panel, use the -useStartupFolderPref
startup option.
matlab -useStartupFolderPref
To set the startup folder from the command prompt, use the -sd
option. For example:
For information about the command line options to set the initial working folder, see matlab (Mac), matlab (Windows), and matlab (Linux).
Compatibility Considerations
If you start MATLAB from a command window and want the startup folder to be the value set in the general preferences panel, then add the -useStartupFolderPref
startup option.
Language and Programming
string
Arrays: Create string
arrays using double quotes
You can create strings using double quotes, just as you can create character vectors with single quotes.
-
str = "Hello, World"
creates a string. -
str = ["Good" "morning"]
creates a1
-by-2
string array.
For more information, see Characters and Strings.
String Functions: Return character arrays or cell arrays instead of string
arrays
The data type of the output argument has changed for the compose, extractAfter, extractBefore, extractBetween, join, split, and splitlines functions. As of R2017a, the output data type depends on the type of the first input argument.
-
If the first input argument is a string array, then the output argument is a string array.
-
If the first input argument is a character vector, then the output argument is either a character vector or a cell array of character vectors.
-
If the first input argument is a cell array of character vectors, then the output argument is either a character vector or a cell array of character vectors.
In R2016b, these functions always return string arrays.
missing
Function: Assign missing values in core data types, including double
, datetime
, categorical
, and string
arrays
To assign missing values to elements of an array or table, use the missing function. For example, catarray(3) = missing
assigns the third element of a categorical array catarray
to a missing value.
issortedrows
Function: Determine if matrix and table rows are sorted
Use the issortedrows function to determine if matrix or table rows are sorted. For example, issortedrows(A,'descend')
checks if the rows of a matrix A
are in descending order based on the elements in the first column.
sort
and sortrows
Functions: Specify options for sorting complex numbers and placing missing elements
Indicate how you want to sort complex numbers and place missing elements using the sort and sortrows functions with the 'ComparisonMethod'
and 'MissingPlacement'
options. For example, if A
is a numeric vector containing complex numbers, then sort(A,'ComparisonMethod','real','MissingPlacement','last')
sorts by the real part of each element and places NaN
values at the end of the sort.
issorted
Function: Query sort order with monotonic, strictly monotonic, strictly ascending, and strictly descending options
You can determine if an array is sorted using the 'monotonic'
, 'strictmonotonic'
, 'strictascend'
, and 'strictdescend'
options with the issorted function. For example, issorted(A,'strictmonotonic')
checks if a vector A
is strictly monotonic.
head
and tail
Functions: Return top or bottom rows of table or timetable
To return the top or bottom rows of a table or a timetable, you can use the head and tail functions.
table
Data Containers: Use row labels when performing join, sort, and grouping operations
When you join tables, sort tables, or use grouping variables, you can specify row labels and table variables together as key variables, sorting variables, or grouping variables. You can specify them in the innerjoin, join, outerjoin, rowfun, sortrows, stack, unstack, and varfun functions. In previous releases, you could specify row labels or table variables, but not both together.
Row labels are the row names of a table or the row times of a timetable.
The innerjoin
, join
, and outerjoin
functions have limitations on key variables:
-
You cannot perform an inner or outer join using row labels as the left key and a table variable as the right key. To perform the inner or outer join, convert the row labels to a table variable and use the new variable as a key.
-
You cannot perform an outer join using both row labels and table variables as key variables. To perform the outer join, convert the row labels to a table variable, or use the row labels as the only key variable.
-
You cannot specify a table as the first input when you perform an inner or outer join on a table and a timetable. The timetable must be the first input.
Functionality being removed or changed
Functionality | Result | Use This Instead | Compatibility Considerations |
---|---|---|---|
|
Still runs |
Not applicable |
Starting in R2017a, the output data type depends on the data type of the first input argument. In R2016b, these functions always return string arrays. For more information, see String Functions: Return character arrays or cell arrays instead of string arrays. |
|
Still runs |
issortedrows |
To determine whether the rows of a matrix are sorted, use the |
|
Still runs |
issortedrows |
To determine whether row times or table variables of a timetable are sorted, use the |
|
Still runs |
Not applicable |
Starting in R2017a, you can specify row labels and table variables together as key variables, sorting variables, or grouping variables. In previous releases, you could specify row labels or table variables, but not both together. For more information, see table Data Containers: Use row labels when performing join, sort, and grouping operations. |
|
Warns |
Live Editor |
In future releases, calling |
|
Still runs |
Not applicable |
Starting in R2017a on UNIX® platforms, if your current working folder is invalid and you call the In previous versions of MATLAB, if your current working folder was invalid and you called |
Graphics
heatmap
Function: Visualize table or matrix data as a heatmap
To create a heatmap chart, use the heatmap function.
legend
Function: Create legends that update when data is added to or removed from the axes
Legends now automatically update when you add or remove graphics objects from the axes. Previously, legends did not automatically add items for new graphics objects or remove items for deleted graphics objects.
For example, this code plots a line and adds a legend. Then the code plots a second line. The legend automatically updates to include the second line.
plot(1:10) legend('Line 1') hold on plot(11:20,'DisplayName','Line 2') hold off
Compatibility Considerations
If you add or delete a graphics object after creating a legend, the number of items in the legend can differ from previous releases. For example, plot a line and create a legend. The plot displays a marker at the maximum point.
x = linspace(0,2*pi); y = sin(x); plot(x,y) legend('sin(x)') hold on plot(pi/2,sin(pi/2),'o','MarkerSize',12) hold off
Result in R2017a | Result in Previous Releases |
---|---|
The legend updates to include the marker. |
The legend does not update to include the marker. |
If you do not want the legend to update automatically, set the AutoUpdate property of the legend to 'off'
. Graphics objects added to the axes after the legend is created do not appear in the legend.
legend('sin(x)','AutoUpdate','off')
To change the behavior for newly created legends, set the default value of the AutoUpdate
property. To affect all new legends, set the value on the root level. Alternatively, to affect all new legends in a particular figure, set the value on the figure level. After you set the default value, any new legends have an AutoUpdate
property set to 'off'
.
[external_link offset=1]
fig = figure; set(fig,'defaultLegendAutoUpdate','off')
Additional options for excluding specific graphics objects from a legend include:
-
Specifying the graphics objects to include in the legend as an input argument to the
legend
function. For example, this code creates a legend that includes only the graphics objects referred to byp1
andp2
. However, graphics objects added to the axes after the legend is created do appear in the legend. Consider creating the legend after creating all the plots to avoid extra items.p1 = plot(1:10); hold on p2 = plot(11:20); p3 = plot(21:30); legend([p1 p2],'line 1','line 2')
-
Excluding graphics objects from the legend by setting their
HandleVisibility
property to'off'
. TheHandleVisibility
property also controls the visibility of the graphics object in theChildren
property of its parent.p4 = plot(31:40,'HandleVisibility','off');
-
Excluding graphics objects from the legend by setting the
IconDisplayStyle
property of the underlying annotation object to'off'
.p5 = plot(41:50); p5.Annotation.LegendInformation.IconDisplayStyle = 'off';
Categorical Plotting: Use categorical data in common plotting functions and customize axes with categorical rulers
These graphics functions accept input data of type categorical.
bar |
barh |
plot |
plot3 |
semilogx (x values must be numeric) |
semilogy (y values must be numeric) |
stem |
stairs |
scatter |
scatter3 |
area |
mesh |
surf |
surface |
fill |
fill3 |
line |
text |
Also, you can use the new categorical ruler to customize the axes. Access the CategoricalRuler
object through the XAxis
, YAxis
, or ZAxis
property of the axes object. For example:
c = categorical({'red','yellow','blue'}); y = [1 2 3]; plot(c,y) ax = gca; ax.XAxis
ans = CategoricalRuler with properties: Categories: [blue red yellow] Limits: [blue yellow] TickValues: [blue red yellow] Show all properties
For a complete list of properties, see CategoricalRuler.
histogram
Function: Plot histograms of datetime and duration data
histogram accepts input data of type datetime and duration. Additionally, you can bin the data using units of time as the bin edges, such as 'second'
, 'hour'
, or 'week'
.
histogram
Function: Sort categorical bins by bar height, and limit the number of bins displayed
histogram can sort categorical bins by bar height (highest and lowest), and additionally it can limit the number of bars displayed. This functionality is most useful with data sets that have a large number of categories, since it enables you to, for example, plot only the 10 largest bars or only the 15 smallest bars.
scatter
Function: Create scatter plots of datetime and duration data
Scatter Plots: Create scatter plots with varying marker sizes faster
When you create a scatter plot and specify the marker sizes using the SizeData
property, the scatter plot renders with improved performance.
parula
Colormap: Create plots with enhanced colors
The default parula colormap has enhanced colors that are more perceptually uniform.
This table shows a comparison between the R2017a and R2016b versions of the parula colormap. The visual change is subtle; however, you might notice more colorful colors and smoother transitions between colors.
R2017a |
|
R2016b |
|
Compatibility Considerations
Plots that use the parula colormap maintain their overall visual appearance. However, the array of colors returned by the parula
function is different. If your code relies on the specific RGB triplet values returned by parula
, then you might need to update your code.
Functionality being removed or changed
Functionality | Result | Use This Instead | Compatibility Considerations |
---|---|---|---|
|
Still runs |
Not applicable |
Legends now automatically update to include new graphics objects added to the axes. Similarly, they update to exclude graphics objects deleted from the axes. For more information, see legend Function: Create legends that update when data is added to or removed from the axes. |
|
Still runs |
Not applicable |
Plots that use the parula colormap maintain their overall visual appearance. However, the array returned by the |
|
Still runs |
Not applicable |
The Previously, the normalization used only binned data in the calculation, which can be less than the total number of input data elements if the data contains |
|
Still runs | Not applicable |
The For example, |
Data Import and Export
datastore
and tabularTextDatastore
Functions: Automatically detect and return date and time data in text files
The datastore and tabularTextDatastore functions detect and return date and time data as datetime
type.
Compatibility Considerations
Previously, datastore
and tabularTextDatastore
functions returned date and time data as character vectors. To preserve that behavior in the datastore function, use:
ds = datastore(location,'DatetimeType','text')
To preserve the old behavior in the tabularTextDatastore
function, use:
ds = tabularTextDatastore(location,'DatetimeType','text')
datastore
Function: Work with data in Amazon S3 cloud storage
Create an ImageDatastore
, FileDatastore
, or TabularTextDatastore
to work with data stored in the cloud using Amazon S3™ (Simple Storage Service). For details, see Read Remote Data.
Import Tool: Import strings and categorical arrays interactively
The import tool now supports importing text as string
and categorical
data types. For more information, see Import Tool.
Compatibility Considerations
Previously, the Import Tool imported text data as a cell array of character vectors. To preserve that behavior, change settings in the Text Options field in the Imported Data section of the Import tab . Click the Text Options field and change the text type selection from String Array
to Cell Array of Character Vectors
.
detectImportOptions
Function: Control import properties of fixed-width text files
Control and customize how data is imported from fixed-width text files using the detectImportOptions function and creating a FixedWidthImportOptions object.
In addition to the SpreadsheetImportOptions
and DelimitedTextImportOptions
objects, the detectImportOptions
function now returns a FixedWidthImportOptions
object. Use the FixedWidthImportOptions
object with readtable to customize import options, such as:
-
Import bad or missing data.
-
Import only a subset of data using the
SelectedVariableNames
property. -
Manage the import of partial fields.
For more information, see FixedWidthImportOptions.
RESTful web services: Support for PUT and DELETE HTTP methods in webread
, webwrite
, and websave
To call HTTP PUT, DELETE, and PATCH methods, use the 'RequestMethod'
argument in the weboptions function.
save
Function: Save workspace variables to a MAT-file with or without compression
Previously, the save command, when saving workspace variables to a MAT-file, used compression as the default (and the only) option. Now, a new option, '-nocompression'
, allows saving of data without compression. This option is only available to use with MAT-File version 7.3
.
By default, saving a variable myVariable
to a MAT-file in version 7.3 compresses the data:
save -v7.3 myFile.mat myVariable
To save myVariable
without compression, use:
save -v7.3 -nocompression myFile.mat myVariable
writetable
Function: Select preferred character encoding when writing to a file
Now, you can specify a character encoding of your choice by using the 'Encoding'
parameter. Previously, the writetable function used the system’s default encoding when writing to a file and that was the only available option. For example, to set file encoding to support Japanese characters, set the Encoding
parameter to Shift_JIS
.
writetable(T, 'filename.csv', 'Encoding', 'Shift_JIS');
NetCDF Functions: Create variable names and attributes containing non-ASCII characters
NetCDF functions now support the use of non-ASCII characters for variable names, attribute names, and attribute values. For more information on creating NetCDF files see, NetCDF Files and netcdf
Webcam Support Package: GStreamer Upgrade on Linux
The MATLAB Support Package for USB Webcams Linux support now uses the GStreamer library version 1.0. It previously used version .10.
jsondecode
converts JSON null
values in numeric arrays to NaN
The jsondecode function converts JSON null
values in numeric arrays to NaN
. For nonnumeric arrays, this function converts a JSON null
value to an empty double
array ([]
). This behavior affects the webread and webwrite functions when processing JSON content.
Compatibility Considerations
Previously, jsondecode
decoded a JSON null
value as an empty double
array, which is dropped from the output. For example:
json = '[1, 2, null, 4]'; res = jsondecode(json) % R2016b
The current behavior is:
json = '[1, 2, null, 4]'; res = jsondecode(json) % R2017a and later
To preserve the old behavior in the jsondecode
function, that is, to remove the NaN
values from the resulting numeric array, use the rmmissing function:
load
and fopen
Functions: Use the file separator character ('\'
) preceding a file name to indicate that the file is in the root folder
Both the load and fopen functions take filename
as an input argument. When specifying this filename
, use the file separator character preceding a file name to indicate that the file is in the root folder. The file separator character is '\'
on Windows and '/'
on UNIX. For example, if you specify filename
as '\myFile.txt'
, then MATLAB searches the root folder for this file.
-
If
myFile.txt
exists in the root folder, then MATLAB proceeds with loading or opening the file. -
If
myFile.txt
does not exist in the root folder, then theload
function returns an error, and thefopen
function returns a-1
indicating that the file could not be opened. -
If
myFile.txt
does not exist in the root folder, but a file with the same name exists in the current folder, then MATLAB behaves in the same way as the previous step. That is, theload
function returns an error, and thefopen
function returns a-1
indicating that the file could not be opened, because no such file exists in the root folder.
Compatibility Considerations
Previously, for the load
and fopen
functions, if you specified a filename
as '\myFile.txt'
, then MATLAB would look for that file in your root folder. If no such file was found in the root folder, then MATLAB would attempt to find and return the file from the current folder. However, now, if you add a file separator preceding the file name, then the load
and fopen
functions will only look for the file in the root folder. Therefore,
-
To indicate that file is located in root folder use
load('\myFile.mat')
orfopen('\myFile.mat')
. -
To indicate that file is located in current folder use
load('myFile.mat')
orfopen('myFile.mat')
.
Additionally, on UNIX platforms, if you use '/'
as the root symbol when specifying the file name, and the file is on the user path, then the path portion specified must case match. That is, MATLAB no longer case-corrects specified paths that begin with the root symbol '/'
. For example, if a file '/user/myFile.mat'
exists under the root folder. Then, on UNIX platforms:
-
load('/user/myFile.mat')
orfopen('/user/myFile.mat')
works correctly. -
load('/User/myFile.mat')
orfopen('/User/myFile.mat')
does not work due to the case mismatch in the specified path.
Functionality being removed or changed
Functionality | Result | Use This Instead | Compatibility Considerations |
---|---|---|---|
Reading video files, with old file formats, on macOS platforms using |
Errors |
Not applicable |
The macOS platform no longer supports certain older video file formats. To read such files using
|
Data Analysis
tall
Arrays: Operate on tall
arrays with more functions, including ismember
, sort
, conv
, and moving statistics functions
tall
Arrays: Index tall
arrays using sorted indices
Now to index tall arrays, you can use ascending or descending sorted indices. The indices can specify elements anywhere in the array, and allow for duplicates. For example:
-
T(0:2:100)
-
T([0528014139])
-
T(100:-10:50)
For more information, see Index and View Tall Array Elements.
tall
Arrays: Work with out-of-memory, time-stamped data in a timetable
isoutlier
and filloutliers
Functions: Detect and replace outliers in an array or table
To find outliers in your data, use the isoutlier function. To replace outliers with alternative values, use the filloutliers function.
smoothdata
Function: Smooth noisy data in an array or table with filtering or local regression
Smoothing noisy data is now possible with the smoothdata function. For example, smoothdata(A,'movmedian')
smooths data with a moving-window median.
summary
Function: Calculate summary statistics and variable information in tables and timetables
To return a structure that contains a summary of a table or a timetable, use the summary function.
histcounts
Function: Bin datetime and duration data
histcounts accepts input data of type datetime and duration. Also, you can bin the data using units of time as the bin edges, such as 'second'
, 'hour'
, or 'week'
.
movmad
and movprod
Functions: Compute moving median absolute deviation and moving product of an array
Use a sliding window to compute the moving median absolute deviation and the moving product along data in an array with the movmad and movprod functions.
bounds
Function: Simultaneously determine the smallest and largest elements of an array
Find the smallest and largest elements of an array with the bounds function.
fillmissing
Function: Replace missing data in an array or table using moving mean or moving median option
Filling missing data using a moving mean or moving median option is now available with the fillmissing function.
Moving Statistics Functions: Supply sample points for time-stamped and nonuniform data in moving statistics functions, such as movmean
Providing sample points that represent the location of data in an array is now possible when computing moving statistics with the functions movmad, movmax, movmean, movmedian, movmin, movprod, movstd, movsum, and movvar. For example, you can compute the moving-window average of data in an array A
with respect to times in a vector t
using movmean(A,'SamplePoints',t)
.
prod
and cumprod
Functions: Ignore NaN
s using 'omitnan'
Now you can exclude NaN
s when calculating the product and cumulative product of an array with the prod and cumprod functions.
Functionality being removed or changed
Functionality | Result | Use This Instead | Compatibility Considerations |
---|---|---|---|
|
Still runs |
Not applicable |
The Previously, the normalization used only binned data in the calculation, which can be less than the total number of input data elements if the data contains |
Support for running MATLAB MapReduce on Hadoop® 1.x clusters will be removed in a future release. | Warns | Use clusters that have Hadoop 2.x or higher installed to run MATLAB MapReduce. | Migrate MATLAB MapReduce code that runs on Hadoop 1.x to Hadoop 2.x. |
App Building
App Designer: Learn to build apps using an interactive tutorial
Learn how to build a simple app using an interactive tutorial that guides you through each step in the process. You can access this tutorial in the App Designer menu.
App Designer: Zoom and pan plots
Enable zooming and panning for plots in your apps using the zoom and pan functions. To enable this functionality, add buttons to your app that call zoom
and pan
in their callbacks. For more information, see Graphics Support in App Designer.
App Designer: Configure columns of a table to automatically fill the entire width of the table
MATLAB automatically calculates column widths so that they expand to fill all available space within the width of the table. This behavior is enabled by default, or whenever the ColumnWidth
property of the Table
UI component is set to 'auto'
for one or more columns.
App Designer: Manage common design-time settings using the Preferences dialog box
Specify which options are always enabled or disabled whenever you work in App Designer. For more information, see App Designer Preferences.
App Designer: Include comet
, graph
, and digraph
visualizations in apps
App Designer: Write ButtonDownFcn
callbacks for graphics objects displayed in UI axes
Create apps containing interactive plots by writing ButtonDownFcn
callbacks for graphics objects such as Line
or Bar
objects. Write the callback in a separate program file that is on the MATLAB path. For example, here is a ButtonDownFcn
callback saved as mybuttondown.m
.
function mybuttondown(src,evt) src.Color = rand(1,3); end
To create a plot line that changes color when the user clicks the line, add this code to any callback in App Designer.
plot(app.UIAxes,1:10,'ButtonDownFcn',@mybuttondown);
Note
The ButtonDownFcn
supports 2-D graphics objects that are children of the UIAxes
(such as Line
, Bar
, and Scatter
). However, UIAxes
objects and Figure
objects created with the uifigure
function do not support the ButtonDownFcn
.
App Designer: Edit table column headings directly in the canvas
Now you can edit table column headings directly in the canvas. The Uitable Properties panel automatically reflects your changes.
App Designer: Disable automatic resize behavior when writing SizeChangedFcn
callbacks
SizeChangedFcn
callbacks no longer execute when the automatic resize behavior is enabled. The automatic resize behavior is enabled when the Resize components when app is resized check box in the UI Figure Properties panel (Design View) is checked.
Compatibility Considerations
In previous releases, the presence of a SizeChangedFcn
callback disabled the automatic resize behavior. The SizeChangedFcn
callback executed whenever the container’s size changed (regardless of the state of the Resize components when app is resized check box). Now, the automatic resize behavior must be disabled to allow the SizeChangedFcn
to execute. Apps created in previous releases will not execute the SizeChangedFcn
callback if the automatic resize behavior is enabled.
To disable automatic resize behavior:
-
Open your app in App Designer, and select Design View.
-
Click a blank area of the canvas to select the UI figure.
-
In the UI Figure Properties panel, deselect the Resize components when app is resized check box.
-
Save and run your app.
Performance
Execution Engine: Improved performance for setting MATLAB object properties
MATLAB has improved the performance of property set methods. For more information on these methods, see Property Set Methods.
save
Function: Save MAT v7.3 files without compression for improved performance on some storage devices
You can improve performance on some storage devices by saving variables to MAT-File version 7.3
without compression. To save a variable (myVariable
) without compression to a MAT-file (myFile.mat
), use:
save -v7.3 -nocompression myFile.mat myVariable
For more information, see save.
memoize
Function: Cache results of a function to avoid rerunning when called with the same inputs
Memoization is an optimization technique used to speed up programs by storing the results of expensive function calls and returning the cached result when the program is called with the same inputs. For more information, see memoize.
Scripts: Improved performance of scripts with lower script overhead
MATLAB has improved the performance of invoking scripts, especially when invoking a script from another script.
[external_link offset=2]
try, catch
Block: Improved performance of try
blocks with lower execution overhead
try, catch
blocks that do not generate errors or throw exceptions now have lower execution overhead.
App Designer: Load apps faster
Loading apps into App Designer is 20% to 35% faster. The time savings becomes more noticeable as the number of components in your app increases.
Mathematics Functions: Various performance improvements
The following mathematics functionality shows improved performance:
-
The backslash command
A\B
is faster when operating on negative definite matrices. -
The transposed backslash command
A'\B
for sparseA
is generally faster, especially for triangular matrices. -
unique executes faster when the input data is sorted.
-
kron shows improved performance with sparse matrices.
-
Dimensional reduction functions (
sum
,prod
,any
,all
, and so on) show improved performance when operating on the second dimension (dim = 2
) of sparse matrices.
Hardware Support
Arduino: Read from quadrature encoders
The MATLAB Support Package for Arduino® Hardware enables you to read from quadrature encoders to determine the speed, acceleration, and position of a rotating device.
Arduino: Wirelessly connect to Arduino MKR1000 board over Wi-Fi
The MATLAB Support Package for Arduino Hardware enables you to wirelessly connect and communicate to the Arduino MKR1000 board over Wi-Fi®.
Advanced Software Development
Class matlab.lang.OnOffSwitchState: Represent on and off as logical values
The matlab.lang.OnOffSwitchState enumeration class provides better logical compatibility for properties and function arguments that have a natural “on” or “off” representation. This class enables properties that represent on/off states to accept logical values (true
, false
, 1
, 0
), as well as the character vectors 'on'
and 'off'
and the enumerations on
and off
.
Object Properties: Validate object property values by their type, size, shape, or other parameters
Class definitions for properties enable you to specify size, class, and other criteria that MATLAB uses to validate values assigned to properties. For more information, see Validate Property Values.
Validation Functions: Validate that values meet specific criteria by calling the appropriate function
Validation functions determine if values meet specific criteria and return descriptive error messages if the values do not satisfy these criteria. The primary use for validation functions is for property validation. For more information on using validation functions, see Property Validation Functions.
Mocking Framework: Isolate a portion of a system to test by imitating behavior of dependent components
When unit testing, you are often interested in testing a portion of a complete system isolated from dependent components. To imitate behavior of dependent components, use the mocking framework. For more information, see Mocking Framework.
Unit Testing Framework: Generate screenshots and figures during testing with ScreenshotDiagnostic
and FigureDiagnostic
To record screenshots and save figures, pass ScreenshotDiagnostic and FigureDiagnostic instances to test qualifications or the log
method of the TestCase
class. For example, within a test, testCase.verifyEqual(actual,expected,ScreenshotDiagnostic)
captures a screen shot when actual
is not equal to expected
. By default, MATLAB only records diagnostics on qualification failures. However, you can record passing diagnostics by configuring the TestRunner
with a plugin such as the TestReportPlugin
or DiagnosticsRecordingPlugin
. To produce the artifacts independently from qualification failures, use the TestCase.log
method.
You can specify where MATLAB stores these artifacts using the ArtifactsRootFolder
property of a test runner. For more information, see matlab.unittest.TestRunner.
Compatibility Considerations
The DiagnosticResult
property name has changed to DiagnosticText
in the following classes in the matlab.unittest.diagnostics
package: Diagnostic
, ConstraintDiagnostic
, DisplayDiagnostic
, and FunctionHandleDiagnostic
.
The TestDiagnosticResult
and FrameworkDiagnosticResult
properties in the matlab.qualifications.QualificationEventData
class have been removed. They are replaced respectively by TestDiagnosticResults
and FrameworkDiagnosticResults
properties that contain DiagnosticResult
objects. The properties they replace were cell arrays of character vectors.
The DiagnosticResult
property in the matlab.diagnostics.LoggedDiagnosticEventData
class has been removed. It is replaced by the DiagnosticResults
property that contains DiagnosticResult
objects. The DiagnosticResult
property was a cell arrays of character vectors.
Unit Testing Framework: Capture screenshots and figures generated during tests using TestReportPlugin
If your tests generate screenshots and figures during tests, they are included in a test report generated with the TestReportPlugin
class. By default, MATLAB stores only the artifacts associated with failed diagnostics. However, you can indicate that your test report includes passing diagnostics, or explicitly log the artifacts in your test using the TestCase.log
method. For more information, see matlab.unittest.plugins.TestReportPlugin.
Unit Testing Framework: Control runtests
function with debug, strict, and verbosity options
The runtests
function has additional options:
-
To pause test execution and enter debug mode in the event of a test failure, use the
'Debug'
option. -
To generate a qualification failure if MATLAB issues a warning during the execution of a test, use the
'Strict'
option. -
To run tests at different verbosity levels, use the
'Verbosity'
option.
For more information, see runtests.
Unit Testing Framework: Select tests by procedure name
You can run tests with a specified procedure name. The procedure name is different from the test element name because it does not include any class or package name or information about parameterization. In a class-based test, the procedure name is the name of the test method. In a function-based test, it is the name of the local function that contains the test. In a script-based test, it is a name generated from the test section title. For example, if a test element name for a test with parameterization is MyTestClass/myTestMethod(param1=val1,parm2=valB)
the procedure name is myTestMethod
.
Unit Testing Framework: Comparator for MATLAB tables
You can use the TableComparator class with the IsEqualTo constraint to compare table values recursively.
Compatibility Considerations
The verifyEqual
, assertEqual
, assumeEqual
, and fatalAssertEqual
methods and IsEqualTo
constraint compare MATLAB tables using the TableComparator
class. Prior to R2017a, they used the ObjectComparator
, which is less strict. Therefore, it is possible that if you have tests that compare classes, test that used to pass might now fail.
Performance Testing Framework: View statistics from test measurements with the sampleSummary
method
Performance Testing Framework: Apply a function across test measurements with the samplefun
method
Source Control Integration: Use Git Pull to fetch and merge in one step
You can now use Pull for Git™ source control integration. Pull fetches the latest changes and merges them into your current branch. Previously, you had to fetch and merge separately before you could see changes. For more information, see Pull, Push and Fetch Files with Git.
MEX builds with 64-Bit API by default
The mex function uses the large-array-handling API (-largeArrayDims
option) by default. Best practice is to update your MEX source code to use this library and rebuild the MEX file. For instructions, see Upgrade MEX Files to Use 64-Bit API.
You can run existing binary MEX files without rebuilding. For more information, see Version Compatibility.
If you build MEX files without using the mex
command options -largeArrayDims
or -compatibleArrayDims
, then review the table in Compatibility Considerations to avoid depending on default behavior that changes in R2017a. For information about the consequences of using the -compatibleArrayDims
option to build MEX files, see What If I Do Not Upgrade?
The default build mode for C MEX S-functions remains -compatibleArrayDims
.
Compatibility Considerations
This table shows the changes you must make to your mex
command to build existing MEX files or S-functions.
Source Code |
mex command — R2016b and earlier | mex command — R2017a and later |
---|---|---|
MEX file C/C++ or Fortran source code uses 32-bit API |
mex myMex.c |
mex myMex.c -compatibleArrayDims |
mex myMex.c -compatibleArrayDims |
No change. |
|
MEX file C/C++ or Fortran source code uses 64-bit API |
mex myMex.c -largeArrayDims |
Use: Or: |
S-function C/C++ source code uses 32-bit API |
mex sfun.c |
No change. |
mex sfun.c -compatibleArrayDims |
No change. |
|
S-function C/C++ source code uses 64-bit API |
mex sfun.c -largeArrayDims |
No change. |
S-function Fortran source code uses 32-bit API |
mex sfun.F |
mex sfun.F -compatibleArrayDims |
S-function Fortran source code uses 64-bit API |
mex sfun.F -largeArrayDims |
No change. |
MEX files and shared libraries: Diagnostic information displayed for failure to load
Java: Supports string
data type
When calling a Java® function, MATLAB converts string
scalar arguments to java.lang.String
and string
array arguments to java.lang.String[]
. For more information, see Pass Data to Java Methods.
The MATLAB string
function converts java.lang.String
scalar arguments to a string
scalar and converts a java.lang.String[]…[]
argument to a string
array with the same dimensions and sizes. For more information, see Handle Data Returned from Java Methods.
Python: Supports string
data type
MATLAB provides the following string data type functionality when using Python® features. For more information about string data types, see Characters and Strings.
-
When calling a Python function, MATLAB converts
string
scalar arguments topy.str
. MATLAB converts<missing>
values instring
arguments topy.None
. For more information, see Pass Data to Python. -
The
string
function convertspy.str
andpy.unicode
types tostring
scalar. For more information, see Handle Data Returned from Python. Thestring
function does not convert objects defining__str__
methods; for example,py.list
orpy.dict
objects. -
The functions pyversion and pyargs accept the
string
data type for input arguments. -
string
scalar arguments can be used to index into Python mapping types. For example, for thepy.dict
objectpatient = py.dict(pyargs('name','John Doe','billing',127));
, you can display the billing value with the statementpatient{"billing"}
.
Python Version 3.3: Support discontinued
Support for Python version 3.3 is discontinued.
Compatibility Considerations
To ensure continued support for your applications, upgrade to a supported version of Python—version 3.4 or 3.5.
MATLAB ships with ActiveState Perl version 5.24 on Windows platforms
MATLAB ships with an updated version of Perl, version 5.24.
Compatibility Considerations
If you use the perl command on Windows platforms, refer to the ActiveState website, https://www.activestate.com, for information about this version.
Compiler support changed for building MEX files and standalone MATLAB engine and MAT-file applications
Support | Compiler | Platform |
---|---|---|
Added |
Intel® Parallel Studio XE 2017 |
Windows |
Added |
Intel Parallel Studio XE 2017 for Fortran |
macOS |
Added |
Xcode 8.x, as of R2016b |
macOS |
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
Functionality | Result | Use This Instead | Compatibility Considerations |
---|---|---|---|
Negation of |
Still runs |
Not applicable |
Change the logic for tests that rely on the negating the ReturnsTrue constraint. |
Generating test suites from a class that derives from a concrete base class that defines methods that reference a |
Warns |
Define either the:
|
In future releases, if your test class inherits from a concrete base class that uses a parameter that is not defined in the base class, MATLAB will throw an error. |
Changes to fieldnames causes the syntax |
Errors |
Use this syntax instead: fieldnames(obj) To determine what properties are defined for MATLAB objects, use the properties function. |
Use the fieldnames function with objects of type COM and Java. |
Defining a property get method for a constant property is not supported. |
Warns |
Constant properties do not support the use of a get method because the value does not change by design. |
In future releases, defining a property get method for a constant property will result in an error. |
Linking to HTML anchor elements from custom documentation is not supported | Still runs | Not Applicable | Custom documentation pages containing links to anchors still display properly, but the browser does not scroll to the linked location. |
Built-in support for the Microsoft® Source Code Control Interface, including |
Errors |
None |
MATLAB no longer includes built-in support for the Microsoft Source Code Control Interface (MSSCCI). Replace this functionality with one of these options:
|
|
Errors |
None |
Replace this functionality with one of these:
|
[external_footer]
Trả lời