by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Visualization
Introduced first in SolidGeometry 5.1, Creation date: 2021-11-18, Last change: 2025-09-15
See Also: plotannotation
, selectsubplot
[n,subs]=subplotnumber([fig])
fig: | default is gcf |
n: | number of subplots | |
subs: | list of handles |
PLsample; subplotnumber
This function, subplotnumber, is designed to determine the number of subplot axes present in a given figure. It is part of the SolidGeometry library and was introduced in version 5.1. The function can be used to retrieve both the count of subplots and their respective handles.
gcf).getfuncparams to retrieve the first argument from varargin, defaulting to gcf if no argument is provided.findobj function. This effectively filters out all subplot axes within the figure.numel, which counts the elements in the subs array.n) and the list of subplot handles (subs).To use this function, you can call it after creating a figure with subplots. For instance:
PLsample; subplotnumber
This will return the number of subplots and their handles for the current figure.
Algorithm explaination created using ChatGPT on 2025-08-18 22:21. (Please note: No guarantee for the correctness of this explanation)