- Within MATLAB on both your old and new computer, run prefdir to identify the directory on both computers that stores your preferences.
- Close MATLAB on your new computer.
- 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).
- Copy your old MATLAB R2024b preferences directory onto your new laptop. Keep the same R2024b directory name.
- (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.
- Now start MATLAB R2025a on your new computer.
Transfer history to MATLAB 2025a
67 views (last 30 days)
Show older comments
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?
0 Comments
Accepted Answer
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:
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.
4 Comments
Benjamin Kraus
on 30 May 2025
@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
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.
More Answers (1)
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:
- 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.
- 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
the cyclist
on 18 May 2025
Yes. Some versions of the LLM-generated responses specifically mentioned that potential downside. I should have mentioned it!
See Also
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!