% figure 窗口最大化,坐标轴也随着窗口变大而相应变大
scrsz = get(0,'ScreenSize');
set(gcf,'Position',scrsz);
或者
set(gcf,'outerposition',get(0,'screensize'));
get(0,'ScreenSize'); 是为了获得屏幕大小,Screensize是一个4元素向量[left, bottom, width, height],然后用获得的screensize向量设置fig的position属性;
get(0) 获取root object(根对象),根对象的所有属性和属性值见:http://www.baisi.net/viewthread.php?tid=6020
例:
To create a figure window that is one quarter the size of your screen and is positioned in the upper left corner, use the root object's ScreenSize property to determine the size. ScreenSize is a four-element vector: [left, bottom, width, height]:
scrsz = get(0,'ScreenSize');
figure('Position',[1 scrsz(4)/2 scrsz(3)/2 scrsz(4)/2])
其实就是用来获得显示器的尺寸,然后确定新建窗口的位置和大小。
代替subplot:
figure,
axes('position',[0 0.54 0.45 0.45]),imshow(im1),axis off;
axes('position',[0.5 0.54 0.45 0.45]),plotflow(flow),axis off;
axes('position',[0 0.08 0.45 0.45]),plotflow(flow,'mag'),axis off;
axes('position',[0.5 0.08 0.45 0.45]),imshow(imflow),axis off;
本文介绍如何在MATLAB中实现图形窗口的最大化,并保持坐标轴随窗口变化而自适应调整的方法。通过使用特定的代码指令,如获取屏幕尺寸、设置窗口位置和大小,可以精确控制MATLAB图形界面的布局。此外,还提供了替代subplot的示例代码,展示了如何创建多个子图并调整其位置。
1412

被折叠的 条评论
为什么被折叠?



