Recover former state of Matlab Editor

146 Ansichten (letzte 30 Tage)
Matt J
Matt J am 24 Feb. 2021
Kommentiert: Sanders am 24 Jan. 2025 um 13:10
I had quite a few files open in the Matlab Editor, but then inadvertently closed the editor window. Is there any way to re-open the editor in a way that recovers its state from before I closed it, i.e., so that the files I had open are automatically open in the editor again, without me having to open them manually, one by one. It seems like the editor does have some memory of its state in some situations, because for example when I close and restart Matlab, the editor does come up again in its former state.

Akzeptierte Antwort

Mario Malic
Mario Malic am 24 Feb. 2021
Bearbeitet: Mario Malic am 24 Feb. 2021
Hi Matt,
Actually, Yair Altman has already mentioned this https://undocumentedmatlab.com/articles/recovering-previous-editor-state
It looks like the info about the editor data, at least on Windows, is kept in file MATLABDesktop.xml
winopen(prefdir)
On the bottom of the file you can find the files that will be opened the next time you start the MATLAB. When you close the file in Editor, the xml file automatically updates and then this .m file won't be opened in Editor the next time.
There's also file MATLABDesktop.xml.prev, which probably stores the same file but from the previous version. Which might be what you're looking for. If you opened/closed MATLAB more than twice with different files open in Editor, then data about previous files is probably lost.
  3 Kommentare
Ernesto Soares
Ernesto Soares am 15 Jul. 2024
THANK YOU Matt J!!!!! I nearly fainted when I accidentally closed the editor.
Sanders
Sanders am 24 Jan. 2025 um 13:10
I would like to reiterate what Mario said in his last line and what was laid out in the article by Yair Altman linked above.
If you accidentally close the editor,
  1. Go directly and make a copy of MATLABDesktop.xml.prev and MATLABDesktop.xml in case you mess up the process
  2. Do not interact with the editor in any way, shape, or form until you have closed matlab. Take this time to save any simulink and workspace work you care about
  3. Now go rename MATLABDesktop.xml.prev to MATLABDesktop.xml (you already made a backup of them both, right?)
  4. Now re-open Matlab and the rest of your work
I renamed MATLABDesktop.xml.prev with Matlab still open and then tried opening the editor which then wiped the contents of MATLABDesktop.xml so now it was also a blank slate.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Specifying Target for Graphics Output finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by