Set the default dock location for numbers

I have learned to attach a default shape in matlab. This can be done by adding this line to the startup function:



This is for example found in the matlab block .

However, this command makes the shape appear on top of my text editor, which also docks. What I want to do is to attach a shape in the upper right quadrant in the matlab workspace. Is there a way to do this?

Note. I'm not sure if it is possible to set the layout using SO hint 2011-08-02 , but I'm not interested in matlabs changing the default setting; Only to change them using the launch function. It is then easy to restore these settings by simply removing them from the startup function.


source to share

1 answer

Here are some undocumented material that might work for you. It may not work in all MATLAB versions, but it seems to work fine in the last few versions I just tested.

First, position the desktop components the way you want them to run (including positioning and docking a group of shapes). Then, from the Layout menu on the Home tab, save the current layout - pretend you save it with a name mylayout


Now move everything around.

Enter a = com.mathworks.mde.desk.MLDesktop.getInstance

to get a link a

to the MATLAB desktop. You now have access to some methods a

that can change its components.

In particular, you can call a.restoreLayout('mylayout')

to reapply the original layout. If there are currently no visible shapes, the shape group will not be present, but you can open an empty shape group with a.showGroup('Figures',true)


You should be able to include these commands in your startup.m

file to arrange things the way you like at startup.

To learn more about how to play with these things, type methodsview(a)

in and you'll get a list of everything that can be done programmatically on the desktop.

Note that this is undocumented, so don't rely on it for anything important. In addition, it is likely that this functionality will not work in all MATLAB releases and will change from release to release as MathWorks continues to improve the desktop environment.



All Articles