?? align_figure.m
字號:
function align_figure(fig,valign,halign)
screen_size = get(0,'ScreenSize');
screen_width = screen_size(3); screen_height = screen_size(4);
pos = get(fig,'Position');
left = pos(1); bottom = pos(2);
width = pos(3); height = pos(4);
if strcmp(get(fig,'MenuBar'),'none')
offset = 20;
menus = findobj(get(fig,'Children'),'type','uimenu');
for k = 1:length(menus)
if strcmp(get(menus(k),'Visible'),'on')
offset = 40;
break;
end
end
else
offset = 40;
end
switch valign
case 'top'
bottom = screen_height-height-offset;
case 'center'
bottom = (screen_height-height-offset)/2;
case 'bottom'
bottom = 0;
otherwise
error(['Invalid vertical alignment ''' halign '''.'])
end
switch halign
case 'left'
left = 0;
case 'center'
left = (screen_width-width)/2;
case 'right'
left = screen_width-width;
otherwise
error(['Invalid horizontal alignment ''' halign '''.'])
end
set(fig,'Position',[left bottom width height]);
return
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -