Is there a way to re-title the Matlab Editor window?
21 次查看(过去 30 天)
显示 更早的评论
Sometimes, I have multiple Matlab instances open and, within each of those, an undocked Matlab Editor window. It would be helpful to me if I could change the title bar of each editor window to something other than "Editor" so that I could label them more distinctively, and know at a glance which Matlab instance I am working in. Does anyone know if there is a way to accomplish this?
2 个评论
Mario Malic
2020-10-14
编辑:Mario Malic
2020-10-14
Hi Matt, I have some clues to help you with as I wasn't able to do it.
Method 1:
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
If you open the editor in undocked mode, evaluate the line in it
wEditor = desktop.getSelected;
You can further inspect methods of it to check
methods(wEditor)
You'll see some methods that may (or may not) help. I am not good with OOC, so I don't know how to dig deeper within methods. Maybe someone else will contribute in the meantime.
Method 2:
doc matlab.desktop.vareditor.VariableEditor
There's a method called setWindowTitle, but wouldn't know how to use it.
Method 3:
Maybe change background color of each MATLAB instance so you can differ them.
采纳的回答
Mario Malic
2020-11-20
编辑:Mario Malic
2021-2-24
Method 3:
Maybe change background color of each MATLAB instance so you can differ them.
Edit:
I have found a solution that barely works, but it's useless. The issue happens when there are changes made to file and then the filename is back to how it used to be, but with an asterisk added.
Regarding the listeners removal, it's only temporary and valid for the window that this code is evaluated in. If you undock or reopen the file, editor will have the default listeners.
desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
winListeners = desktop.getSelected.getTopLevelAncestor.getWindowListeners;
desktop.getSelected.getTopLevelAncestor.removeWindowListener(winListeners(2)); % when the window is minimised, and brought back again, the name returns, therefore this listener is removed
desktop.getSelected.getTopLevelAncestor.setTitle('My undocked file');
1 个评论
Michael S
2023-10-24
I am also using the com.mathworks package to mofify the Matlab Instance name.
It will be removed in a future release, accordin to Mathworks.
ist threre some kind of replacement for this?
I am using it a such:
jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
jDesktop.getMainFrame.setTitle('Some Project Title);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!