Custom GINPUT

Version 1.0.0.1 (4,56 ko) par Jiro Doke
GINPUT with customizable cursor.
4,9K téléchargements
Mise à jour 1 sept. 2016

Afficher la licence

Note de l’éditeur : This file was selected as MATLAB Central Pick of the Week

This function behaves similarly to MATLAB's GINPUT, with an added ability to customize the cursor color, line width, and line style. From the function HELP:
[X,Y] = ginputc(N) gets N points from the current axes and returns the X- and Y-coordinates in length N vectors X and Y. The cursor can be positioned using a mouse. Data points are entered by pressing a mouse button or any key on the keyboard except carriage return, which terminates the input before N points are entered. Note: if there are multiple axes in the figure, use mouse clicks instead of key presses. Key presses may not select the axes where the cursor is.

[X,Y] = ginputc gathers an unlimited number of points until the return key is pressed.

[X,Y] = ginputc(N, PARAM, VALUE) and [X,Y] = ginputc(PARAM, VALUE) specifies additional parameters for customizing. Valid values for PARAM are:
'Color' : A three-element RGB vector, or one of the MATLAB predefined names, specifying the line color. See the ColorSpec reference page for more information on specifying color. Default is 'k' (black).
'LineWidth' : A scalar number specifying the line width. Default is 0.5.
'LineStyle' : '-', '--', '-.', ':'. Default is '-'.
'ShowPoints' : TRUE or FALSE specifying whether to show the points being selected. Default is false.
'ConnectPoints' : TRUE or FALSE specifying whether to connect the points as they are being selected. This only applies when 'ShowPoints' is set to TRUE. Default is true.

[X,Y,BUTTON] = ginputc(...) returns a third result, BUTTON, that contains a vector of integers specifying which mouse button was used (1,2,3 from left) or ASCII numbers if a key on the keyboard was used.

[X,Y,BUTTON,AX] = ginputc(...) returns a fourth result, AX, that contains a vector of axes handles for the data points collected.

Examples:
[x, y] = ginputc;

[x, y] = ginputc(5, 'Color', 'r', 'LineWidth', 3);

[x, y, button] = ginputc(1, 'LineStyle', ':');

subplot(1, 2, 1); subplot(1, 2, 2);
[x, y, button, ax] = ginputc;

[x, y] = ginputc('ShowPoints', true, 'ConnectPoints', true);

Citation pour cette source

Jiro Doke (2024). Custom GINPUT (https://www.mathworks.com/matlabcentral/fileexchange/38703-custom-ginput), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2012b
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Visual Exploration dans Help Center et MATLAB Answers
Remerciements

A inspiré : gdist, clickz, GINPUT FOR UIAXES, gdistm

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0.1

Updated license

1.0.0.0