
Undocumented Secrets of MATLAB
®
-Java Programming478
First, we need to get the Java handle of the MATLAB desktop. We can then investigate
this handle using the built-in methodsview function or my uiinspect utility which was
described above. We quickly see the relevant layout-related functions, which we can put to
good use:
% Get the desktop's Java handle (Matlab 7 only)
jDesktop = com.mathworks.mde.desk.MLDesktop.getInstance;
% Inspect the available desktop functions
methodsview(jDesktop);
uiinspect(jDesktop);
% Get and set the layout-saving policy
oldPolicy = jDesktop.getLayoutSavePolicy;
set(jDesktop,'LayoutSavePolicy',
jDesktop.getLayoutSavePolicy.NEVER); ...