Is there a way to re-title the Matlab Editor window?
29 views (last 30 days)
Show older comments
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 Comments
Mario Malic
on 14 Oct 2020
Edited: Mario Malic
on 14 Oct 2020
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.
Accepted Answer
Mario Malic
on 20 Nov 2020
Edited: Mario Malic
on 24 Feb 2021
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 Comment
Michael S
on 24 Oct 2023
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);
More Answers (0)
See Also
Categories
Find more on Environment and Settings 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!