Recover former state of Matlab Editor

71 次查看(过去 30 天)
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.

采纳的回答

Mario Malic
Mario Malic 2021-2-24
编辑:Mario Malic 2021-2-24
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.
  1 个评论
Matt J
Matt J 2021-3-1
编辑:Matt J 2021-3-1
Thanks, Mario.
Neither of the prefdir/MATLABDesktop.xml files seem to remember anything once the editor window is closed but prefdr/MATLAB_Editor_State.xml does remember!
It appears to be a log of the last several dozen opened files. It doesn't tell you which files co-existed in the Editor at the same time, but it as at least possible to parse MATLAB_Editor_State.xml to re-open the last 5 (or however many) files that were visited.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by