figure2struct

Categorize MATLAB graphics objects in a figure/axes and return them as fields of a structure

https://github.com/yulkang/figure2struct

您现在正在关注此提交

Categorize MATLAB graphics objects in a figure/axes and return them as fields of a structure.
h = figure2struct(src)
src : handle of a figure, an axes or handles of its children.
gcf by default.
When a figure is given, the returning struct h has the same
number of rows and columns as the subplots.
The rows and columns are determined based on the position,
without using subplot. So this function can be used with
figures where the subplots are repositioned, e.g., for printing.

h(row,col) : a struct containing the following fields:
- axes
- children (all children regardless of kind)
- line
- text
- legend
- marker (line with LineStyle = 'none'),
- segment (line with only two coordinates),
- segment_vert
- segment_horz
- crossline (line that spans at least one axis)
- nonsegment (lines that connect more than two points).

To use just one axes out of multiple subplots, use:

copyobj(h(row,col).axes, figure);

To find a subset of the objects, use findobj. For example:

red_markers = findobj(h(row,col).marker, 'Color', [1 0 0]);

引用格式

Yul Kang (2026). figure2struct (https://github.com/yulkang/figure2struct), GitHub. 检索时间: .

类别

Help CenterMATLAB Answers 中查找有关 Graphics Object Properties 的更多信息

MATLAB 版本兼容性

  • 兼容任何版本

平台兼容性

  • Windows
  • macOS
  • Linux

无法下载基于 GitHub 默认分支的版本

版本 已发布 发行说明 Action
1.0.0.0

minor cosmetic change in the description.
Removed MarkDown in the description which is not supported.

Corrected required MATLAB version to R2015a (due to uniquetol() used in subplot_by_pos - may be updated in the future so that it doesn't depend on uniquetol(). Please comment if you have an older version and are interested.
Changed the title of the submission.
Added description.

要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 存储库
要查看或报告此来自 GitHub 的附加功能中的问题,请访问其 GitHub 存储库