workingArea

版本 1.0.0 (2.8 KB) 作者: Paul Mennen
Returns the size and position of the area of the screen where you can place figures without obscuring the taskbar.
8.0 次下载
更新时间 2021/5/22

查看许可证

Suppose you want to create a small figure window at the upper-left corner of the screen and another one at the lower-right corner. The obvious way to do this is to get the screen size using get(0,'screensize') and use that to position the figures. Using that method, one of those figures would cover part of the taskbar which would not likely be your intention. To do this properly you need to query for the location and size of the screen working area (i.e available area not occupied by the task bar). One way to do this is to use this sequence:
a = figure('WindowState','maximized'); pause(.1); get(a,'outerposition')
One problem with that method is that is hard to be sure how long a pause is required. (It doesn't work without the pause.) And even if you immediately delete or resize the figure you will still see the screen flash unnecessarily. Another problem with that method is that it will only work on Matlab version R2020a or newer. For older versions of Matlab, the same thing could be done using the JavaFrame undocumented feature, but that won't work with even older versions of Matlab or with Octave. This function solves that problem by returning the screen working area without needing to create a dummy figure window and it works across all Matlab versions (and even Octave).
Unfortunately this function has only been tested under Windows 10 and probably would need substantial modification to work under Linux or Mac OS.
Type "help workingArea" to see eight examples of using this function to create figure windows of various sizes and positions.

引用格式

Paul Mennen (2024). workingArea (https://www.mathworks.com/matlabcentral/fileexchange/92688-workingarea), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2021a
兼容任何版本
平台兼容性
Windows macOS Linux
标签 添加标签

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0