bio_img_matlab

The MATLAB Blog

Practical Advice for People on the Leading Edge

MATLAB R2025a has been released – What’s new?

As the first version following MathWorks' 40th anniversary in 2024, MATLAB R2025a is probably the biggest release I've ever experienced as both a user and a MathWorker. The breadth and depth of what's new is so large that it makes my head spin a little and I'm almost not sure where to start in an overview post like this. Almost!
This blog post is just a quick tour through some of my highlights of this release. There are hundreds of new features (or thousands depending on how you count them) and I couldn't possibly discuss them all in an article like this. Head over to the full release notes to see all of the details for yourself and keep an eye out on the various MATLAB Blogs for deeper dives into the new functionality in the near future.

The new MATLAB desktop

The first thing you're going to notice on opening the desktop version of MATLAB is that it has a completely refreshed look. The old Java-based desktop is gone and is replaced by one that uses technologies such as JavaScript and HTML for a much more modern experience. Millions of you will find it familiar because it is, in fact, the same desktop that we've been using and developing in MATLAB Online for several years now. The new desktop has also been available as a Beta-version add-on for over 2 years (e.g. see my blog post from March 2023 discussing it) and we've received feedback on it from thousands of users. There are people at MathWorks who have read and processed every single piece of that feedback! Thank you again to everyone who took the time to tell us how you were getting on with the new desktop.
Now that MATLAB Online and Desktop MATLAB share the same, modern code-base we'll be able to bring new features to you much more quickly. You can expect faster access to cutting-edge tools, streamlined workflows and more frequent updates that help you stay at the forefront of technical computing. Let's look at a summary of some of the new desktop features we've already delivered as part of this release.

Dark mode and improved accessibility

I previewed this over two years ago when the first beta version of the new desktop was released and now its part of the default MATLAB desktop. Join the millions of users of MATLAB Online and rest your eyes in the desktop version of MATLAB. Head over to Change Desktop Theme and Colors to learn how to do it.
On the accessibility front, it's now possible to use a screen reader to work with the Command Window, move around the MATLAB desktop tools, and create or edit files in the Editor and Live Editor. This was available as a beta for R2024b but is now fully integrated into the product. Screen reader support has also been added to figure interaction. You can check out more details in the documentation at Accessibility in MATLAB.

Side panels and documents in the new desktop

In the new desktop, everything below the toolstrip is either a document or a side panel (and occasionally both!). Roughly speaking, documents are working areas and side panels are supporting tools for various workflows. Documents include things like .m files, figures and Live Scripts. Examples of side panels include the Files Panel (replacing the Current Folder browser), the test browser panel and the Debugger panel. More details including how to configure the new desktop can be found in the documentation page Configure the Desktop and I'll follow up with my own tour of the desktop soon.

We want your feedback

I have no doubt that you have questions and comments about this new desktop and we are here to give you answers. Your options include dropping a comment here, starting a conversation over at MATLAB Central, contacting support or hit the feedback button right there in the MATLAB desktop; another feature of the new desktop that I discussed near the end of March.

New figure container and toolstrip

In older versions of MATLAB, every new figure would be created in its own window. In R2025a, the default behavior is for figures to open as tabs docked in a figure container. There's a lot to say about this new figure ecosystem and the MATLAB Graphics and App Building blog will be bringing you all of the details soon.

MATLAB Copilot

Generative AI has the potential to transform how engineering and science is done and some of the most popular recent posts on The MATLAB Blog have been on the topic. My October 2024 article, 4 ways of using Large Language Models (LLMS) with MATLAB needs to be updated because now there is another way.
MATLAB Copilot is a new product from MathWorks that integrates generative AI models with your everyday workflows in MATLAB. Expect to hear a lot more about MATLAB Copilot in future blog posts.

Further evolution of Live Scripts

I love live scripts. Indeed, every post on The MATLAB Blog is written as a Live Script that then gets converted to something WordPress can consume using wp_publisher from File Exchange so they are part of my daily workflow. One feature that I've been eagerly waiting for is the ability to embed YouTube videos into Live Scripts; such as this one.
The rise in popularity of the workflow is one of the reasons why more people than ever are using Live Scripts with git and GitHub. However, traditional Live Scripts have a problem: They are in a binary file format which means that they don't play nicely with text-centric version control systems such as git. This is why MathWorks have developed a new plain text live code format. This was available as a beta in R2024b and is now fully-fledged and part of the R2025a release. The screenshot below gives a hint of what's going on. For more details check out the documentation Live Code File Format (.m).

Additional Markdown support

Over the last few releases, we've been adding support for Markdown documents including things like syntax highlighting for Markdown in the MATLAB editor (R2024a) and the ability to export Live Scripts to Markdown via the export function (R2023b). The big Markdown news in this release is the ability to render Markdown documents in the MATLAB editor.

Enhanced GPU functionality

Last year I took a deeper look at all of the functions in MATLAB that have NVIDIA GPU support via the gpuArray datatype. In R2024, 1195 functions were supported across 14 toolboxes. R2025a brings those numbers up to 1256 functions across 17 toolboxes. Here's a graph of the growth over time.
One example I found particularly interesting was Accelerate Ray Tracing Analysis Using GPU from Antenna Toolbox. This set up a transmitter and receiver in Hong Kong using building data from OpenStreetMap and computed the propagation paths between sites using both CPU and GPU. The documentation shows a GPU speed-up of 3.6x which is pretty close to the 2.9x speed-up I observed when I ran it on my machine. Of course the exact speed-up will vary according to you hardware but I found it very easy to run the example and find out for myself.
propagation paths found by the GPU between transmitter and receiver using building data for Hong Kong from OpenStreetMap.
The number of new functions supporting gpuArray are only part of the GPU story in MATLAB. There are also a number of older gpuArray functions that have been made faster such as mean (2.4x faster) , movmean (1.6x faster), histcounts (1.7x faster) and improved training and inference performance for Transformer Networks in Deep Learning Toolbox (2.5x faster). Of course the actual speed-ups you'll experience depend on both your hardware and the details of each problem; all of the links to the speed-ups I've just given you contain full details of our test set-up.
Then we have some functions where the gpuArray support has been enhanced - bwdist, for example, has extended its GPU support to include the processing of 3-D images while min, max, sum, prod, ind2sub, rem, mod, power, realpow, mean, median, intmin, intmax, cummin, cummax, cumsum and cumprod have all been extended so that you can use int64 on the GPU. There's also support for a new data-type: single precision sparse matrices and dozens of functions have been updated to support it on the GPU.
A small quality of life update to gpuArray workflows is the ability to gather gpuArray objects from the Desktop. You just right-click the variable in the workspace and select Gather from GPU.

Performance analysis in GPU Coder

Moving on to look at GPU functionality outside of gpuArray, I now turn to GPU Coder which is a product that generates CUDA code from MATLAB code. There is an update to the GPU Performance Analyzer that automatically detects common performance bottlenecks in generated CUDA code when you use the gpuPerformanceAnalyzer function. The Profiling Timeline pane indicates bottlenecks with a warning icon , and the new Diagnostics pane describes the bottlenecks
While on the subject of performance evaluation of code generated by GPU Coder, I urge you to take a look at the new Analyzing Network Performance Using the Deep Learning Dashboard page in the documentation. The following screenshot alone makes me want to investigate it much more deeply (pun not intended).
Along with these new performance tools, GPU Coder has a range of additional enhancements including support for new functions, new deep learning layers and the generation of more optimized CUDA code for median, cumtrapz and envelope. Some of these optimizations are rather dramatic too with CUDA code generated from cumtrapz, for example, being approximately 20x faster than before.
See Release Notes for GPU Coder for more of everything else that's new here.

Coding and Software Development

This is a big release for coding and software development workflows. Many of the new panels in the new desktop, for example, are related to these topics with the Source Control panel, shown below, being a prime example. Other panels of interest here are Debugger, Project, Test Browser, Code Issues, and Code Outline.
Outside of the new desktop, you can see that there are a lot of additional software development enhancements in areas such as Projects, Code Analyzer, Git Source Control, Build Automation, Unit Testing Framework and Toolbox packaging.

Progress with MATLAB and Python

When I deliver seminars and workshops on the integration of MATLAB and Python, one of the first things I tell my audience is "Always use the latest version of MATLAB if you are interested in using MATLAB and Python together". This is because we improve this functionality every release and R2025a is no exception. Let's start with a quality of life improvement to dealing with Python environments.
Before running Python functions in MATLAB, you first have to decide if you want to run Python in the same process as MATLAB (ExecutionMode=="InProcess") or in a separate process (ExecutionMode="OutOfProcess") and there are pros and cons of each. Prior to R2025a, if you wanted to switch execution mode, you would always have to restart MATLAB. Now, however, if you start off with OutOfProcess and change your mind you can terminate it and switch to InProcess without needing to restart MATLAB.
% Create an OutOfProcess Python Environment
pe = pyenv(ExecutionMode="OutOfProcess");
% Do a calculation in Python
py.math.sqrt(2)
ans = 1.4142
Let's say that I've changed my mind and don't want to run Python out of process anymore. I first terminate it
% Terminate the OutOfProcess Environment
terminate(pe)
and then proceed with creating a new environment. Prior to R2025a, this would have required me to restart MATLAB
%Create an InProcess Python Environment
pe = pyenv(ExecutionMode="InProcess");
 
% Run a Python command using this new environment
py.math.sqrt(3)
ans = 1.7321
You still can't do it the other way around, however. Once you have an InProcess Python environment, you can't switch to an OutOfProcess environment without restarting MATLAB.
So much for calling Python from MATLAB. There have also been some improvements on calling MATLAB from Python. In particular, MATLAB tables and timetables get automatically converted into Pandas data frames and vice versa. It's also easier to work with MATLAB's datetime and duration datatypes in Python as they too automatically get converted to the relevant Python datatypes. This makes it much easier to transfer data between MATLAB and Python functions when working in Python.
Here are a few additional Python-related enhancements across various other MathWorks' products in this release.
Rounding things off, here are a few updates related to Python and Simulink. Since I'm not a Simulink guy, I'll just link to each release note without further comment.

Single precision sparse matrices

When your matrix has more zeros than anything else, it often pays to use sparse matrices. For many years, sparse matrices in MATLAB could only either be of type double or logical. The ability to create and use single precision sparse matrices has been requested by a huge number of users and so we are happy to announce full support for single precision sparse matrices in R2025a.
Almost everywhere in MATLAB where you can use a double precision sparse matrix, you can now use a single sparse matrix as well and that includes on NVIDIA GPUs and in Distributed arrays. Creating a single precision sparse matrix is as easy as adding "single" to the creation function
mySingleSparse = speye(3,"single")
mySingleSparse = 3×3 sparse single matrix (3 nonzeros)
(1,1) 1 (2,2) 1 (3,3) 1
or you can convert from an existing double sparse matrix
myOtherSparse = single(someDoubleSparse);
A deep dive into this functionality will be appearing soon on The MATLAB Blog and I'll link to it here when it's ready.

Maximum length of MATLAB identifiers increased to 2048 characters

This would have resulted in an error message in previous versions of MATLAB since the maximum number of characters used for identifiers such as function and variable names used to be 63. Now it's 2048.
NowWeCanCreateExtremelyLongVariableNamesIfWeAreSoInclinedAndAreNoLongerLimitedTo63Charcters = 42
NowWeCanCreateExtremelyLongVariableNamesIfWeAreSoInclinedAndAreNoLongerLimitedTo63Charcters = 42
Personally, I rarely hit the 63 character limit since I'm the kind of programmer who would prefer to do
N = 42
N = 42
There are some users, however, who have a need for longer identifiers. We have a lot of AUTOSAR users, for example, where the maximum identifier length is 128 characters so MATLAB's old 63 character limit could sometimes cause compatibility problems. Another use case is auto-generated MATLAB code based on things defined in external documents. In turn, those documents might be based on some standard that leads to quite long names.
The last time we increased this limit was in 2002 when it was increased from 31 to 63 characters. This was also when we introduced the namelengthmax function which has returned 63 for more than two decades. In R2025a, it will return 2048. We can't rule out the possibility that it might change again sometime in the next couple of decades so make sure you use namelengthmax instead of hard-coding the limit if you write code that depends on this.
You probably fall into one of two camps regarding this change. One group will never care and wonder why on earth you'll need more than 63 characters for a MATLAB identifier and other group will be saying "Finally! This has been causing me pain for a long time."

Many data import functions now support compressed files

This is another quality of life improvement. In older versions of MATLAB if someone sent you some data as a .zip file, you had to decompress it before you could open it.
unzip("somedata.zip")
data = readtable("somedata.csv")
data = 3×3 table
col1col2col3
1123
2456
3789
Now you can just open it direct from readtable without polluting the file system with the uncompressed .csv file
data = readtable("somedata.zip/somedata.csv")
data = 3×3 table
col1col2col3
1123
2456
3789
Note that .zip files are treated as folders since they could hold many files. As such, you have to specify the file you want even if there is only one of them as there is here.
This also works for .gz and .tar files as well as .zip files and has been enabled for the following functions
This functionality has been requested by many users so I hope that we've made them happy.

What are your favorite new features?

This has been a long post and earlier drafts were even longer! It's difficult to decide what not to mention in posts like this. Have I missed your favorite new feature in this overview? If so, let me know what it is in the comments section. If you haven't had chance to look at all the details yourself yet, please head over to the release notes and dive in
|
  • print

评论

要发表评论,请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。