Is there a way to re-title the Matlab Editor window?

29 visualizaciones (últimos 30 días)
Matt J
Matt J el 14 de Oct. de 2020
Comentada: Michael S el 24 de Oct. de 2023
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 comentarios
Mario Malic
Mario Malic el 14 de Oct. de 2020
Editada: Mario Malic el 14 de Oct. de 2020
Hi Matt, I have some clues to help you with as I wasn't able to do it.
Method 1:
Answer here is quite helpful,
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.
Matt J
Matt J el 20 de Nov. de 2020
Method 3: Maybe change background color of each MATLAB instance so you can differ them.
That sounds like a good alternative. If you submit it as an answer, I will Accept it.

Iniciar sesión para comentar.

Respuesta aceptada

Mario Malic
Mario Malic el 20 de Nov. de 2020
Editada: Mario Malic el 24 de Feb. de 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 comentario
Michael S
Michael S el 24 de Oct. de 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);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Environment and Settings en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by