Resizable MATLAB figures
This is a layout manager for axes and controls in a MATLAB figure, designed for graphical user interfaces in which, during resizing of the figure, some controls (e.g. buttons) are to remain the same size while others (e.g. axes, text fields, list boxes) are to change size.
To achieve this, the figure is split into a grid with a border and with spacing between each cell. Some rows and columns (at least one of each) are variable in size and the rest are fixed. When the figure is resized, the available space (i.e. that not required by the fixed-size rows and columns) is distributed among the variable-sized ones according to a specified ratio. If there is not enough space for the fixed-size rows or columns, these (and the spacing between them) will be made smaller too.
Controls can be merged across multiple rows and/or columns and can overlap (making it possible to put a frame round other controls).
Example code is provided. The basic sequence is:
* Create figure (using the supplied function "resizable_figure")
* Create controls (axes, uicontrols, ActiveX controls, java components)
* Create an "elements" cell-matrix to specify top-right positions for controls.
* Create a "mergeblocks" matrix giving sizes for components which span more than one cell in the grid
* Specify row and column sizes (positive sizes are specify fixed sizes in pixels, negative ones give the ratios for resizable rows and columns)
* Set the initial size for the figure and show it
The code has been tested with MATLAB 6.1 (R12.1) through MATLAB 7.1 (R14sp3).
引用格式
Malcolm Wood (2024). Resizable MATLAB figures (https://www.mathworks.com/matlabcentral/fileexchange/10309-resizable-matlab-figures), MATLAB Central File Exchange. 检索来源 .
MATLAB 版本兼容性
平台兼容性
Windows macOS Linux类别
标签
致谢
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!