Transfer history to MATLAB 2025a

Hi everybody.
I bought a new computer and I want to transfer the MATLAB history I had on the old one. The new computer has MATLAB 2025a installed, while the old one has MATLAB 2024b.
I already transfer histories in the past and it was as simple as copy and paste the History.xml from a computer to another. However, with MATLAB 2025a, history is no longer saved in the History.xml. How can I transfer the command history from the old computer (and MATLAB 2024b) to the new one with MATLAB 2025a?

 Accepted Answer

Benjamin Kraus
Benjamin Kraus on 27 May 2025
Edited: Benjamin Kraus on 27 May 2025
When you start MATLAB for the first time it will automatically look for an old MATLAB preferences directory and automatically import your settings and history from that old preferences directory.
My recommendation, if you just installed MATLAB R2025a on a new computer, is:
  1. Within MATLAB on both your old and new computer, run prefdir to identify the directory on both computers that stores your preferences.
  2. Close MATLAB on your new computer.
  3. Delete your R2025a preference directory from the new computer (create a backup copy first if you think there may be something you need to preserve).
  4. Copy your old MATLAB R2024b preferences directory onto your new laptop. Keep the same R2024b directory name.
  5. (optional) If you want to reset all your preferences and only import your history, delete everything from the preference directory except History.xml. I think this will work to just preserve your history, but I'm not certain.
  6. Now start MATLAB R2025a on your new computer.
MATLAB R2025a should recognize the old preference directory and automatically import your history (and potentially other settings) into the new format. It is essential that you delete the existing R2025a preferences directory, as MATLAB won't look for an old preferences directory if a new one exists already.

7 Comments

This worked perfectly. Just for reference, with MATLAB closed:
  1. Created a folder called R2024b in the preference directory of the new computer
  2. Copied only the History.xml file in this R2024b folder
  3. Deleted the R2025a preference folder (actually, I renamed it to have a backup just in case)
  4. Opened MATLAB
Andrey
Andrey on 30 May 2025
Edited: Andrey on 30 May 2025
Yes, it should, but it doesn’t. All files from the 2024b directory were transferred and even contain the same information, but the Editor did not open, even though data about the files is present.
How can I solve this and open the Editor? I’d prefer not to reopen all the files manually.
@Andrey: You seem to be facing an issue different from the original question, which was about restoring the command line history from R2024b on one computer to R2025a on a different computer. Your question seems to be about documents open in the Editor (I think?). You may have better luck posting a separate question, and if you do, you will want to include a lot more context about the issue you are facing.
Aidin Razavi
Aidin Razavi on 16 Jun 2025
Edited: Aidin Razavi on 16 Jun 2025
Tried this, but the command history is still not transfered.
UPDATE: The reason was that I had tried the new desktop on R2024B. It wasn't able to transfe history at that point and I had switched back exactly for this reason. Now, those settings were being imported and didn't contain any of the command history or the open files in the editor.
Solution: After step 4, delete the four files from the old installation's prefdir. (of course it's always a good idea to keep backups in case something happens. The files to be deleted: "slhistory.mlsettings", "mpm.mlsettings", "mf.mlsettings", "matlab.mlsettings".
And now I have all my command history and also the open files in the editor.
This is very frustrating. I have tried all of the solutions listed here. I even tried to look for the patch listed in this solution, but couldn't find it. I even downloaded 2025a after 2025b hoping it would work from 2025a and then I could put it into 2025b. It actually copies the History.xml file but doesn't import anything.
The history is invaluable. Every once in a while I have to go back several years because I need to see how I ran something from years ago. This really does need a new solution. It shouldn't be this hard.
Wesley
Wesley on 1 Mar 2026 at 12:27
Edited: Wesley on 1 Mar 2026 at 12:34
@Eric Homer It worked for me with R2025b.
! Important: You will have to update the History.xml with current history (manually or with a script) if you want to preserve or merge them too.
  • MATLAB needs to be closed
  • Copy the History.xml in a new "R2024b" folder nothing else. The folder is created in one level up the directory pointed by "prefdir" command. Looks like "...\AppData\Roaming\MathWorks\MATLAB\R2024b\History.xml" after copying.
  • Rename or remove (backup) the "R2025b". Optional: Backing up "matlab.mlsettings" file may come in handy. Not sure which other files are independent or important.
  • Start MATLAB it should create "R2025b" and your history should be restored
  • Optional: Close MATLAB and copy "matlab.mlsettings" into the new "R2025b" to restore settings and last open editors and current folder
Eric Homer
Eric Homer on 3 Mar 2026 at 0:26
Edited: Eric Homer on 3 Mar 2026 at 0:27
@Wesley, thanks for taking the time to respond.
I have done that 3-4 times, with and without other files. From R2024b to R2025a, R2024b to R2025b, from R2023b and even R2024a to R2025b. I've tried with lots of files and with just History.xml.
I will note that I am on a Mac so my prefdir is '/Users/my_username/Library/Application Support/MathWorks/MATLAB/R2025b'.
I'm just not sure what else to do at this point.

Sign in to comment.

More Answers (1)

the cyclist
the cyclist on 17 May 2025
I did not know the answer to your question, so I decided to as in the AI Chat Playground. Here is what it came up with.
In MATLAB 2025a, the Command History is no longer saved in a History.xml file. Instead, it is stored in the MATLAB settings. Unfortunately, this means you cannot directly transfer the command history from MATLAB 2024b to MATLAB 2025a by copying a file.
To transfer your command history, you can follow these steps:
  1. Export History from MATLAB 2024b:
  • Open MATLAB 2024b.
  • In the Command History window, select the commands you want to save.
  • Right-click and choose "Export Selected" to save the commands to a .txt file.
  1. Import Command History into MATLAB 2025a:
  • Open MATLAB 2025a. - the diary function to log your commands: matlab diary('imported_history.txt'); % Start logging % Manually re-enter or copy-paste commands from the .txt file diary off; % Stop logging
  • This will create a new diary file with the commands you entered.
While this method does not directly transfer the history, it allows you to recreate your command history in the new version.

3 Comments

This would surely result in the imported commands being executed ?
Yes. Some versions of the LLM-generated responses specifically mentioned that potential downside. I should have mentioned it!
I would really avoid to have to run 100,000 commands 😁

Sign in to comment.

Categories

Products

Release

R2025a

Asked:

CaG
on 17 May 2025

Edited:

on 3 Mar 2026 at 0:27

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!