Syntax
[hi,cfsp]=selectsubplot
Output Parameter
hi : | | selected subplot by last click cursor position |
cfsp : | | list of all subplots |
Examples
PLsample; ginput(1);
selectsubplot
Copyright 2021-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, selectsubplot
, is designed to interactively select a subplot within a MATLAB figure. It is part of the SolidGeometry library and was introduced in version 5.0. The function is primarily used for user interface purposes, allowing users to identify and work with specific subplots within a graphical figure.
Input Parameters
The function selectsubplot
does not take any input parameters. It operates on the current figure and axes available in the MATLAB environment.
Output Results
- hi: This is the handle to the subplot that was selected by the last click cursor position. It identifies which subplot the user interacted with last.
- cfsp: This is a list of all subplot handles within the current figure. It provides a comprehensive list of all subplot axes present in the figure.
- hk: This is a list of subplot handles that were not selected. It includes all subplot axes except the one identified by
hi
.
Algorithm Steps
- The function begins by identifying all objects of type 'Axes' within the current figure using the
findobj
function. This is stored in the variable cfsp
.
- It then determines which of these axes is the current axes (the one most recently interacted with) using
ismember
in conjunction with gca
(get current axes). The result is stored in hi
.
- The function also identifies all axes that are not the current axes by using the logical negation of the previous step. These are stored in
hk
.
Example Usage
An example of how to use this function is provided in the comments:
PLsample; ginput(1);
selectsubplot
In this example, PLsample
presumably sets up a figure with subplots, and ginput(1)
waits for a mouse click to select a subplot. The selectsubplot
function is then called to identify the selected subplot.
Algorithm explaination created using ChatGPT on 2025-08-18 22:27. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21