Custom GINPUT

Versión 1.0.0.1 (4,56 KB) por Jiro Doke
GINPUT with customizable cursor.
5K Descargas
Actualizado 1 sep 2016

Ver licencia

Nota del editor: 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);

Citar como

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

Compatibilidad con la versión de MATLAB
Se creó con R2012b
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Data Exploration en Help Center y MATLAB Answers.
Agradecimientos

Inspiración para: 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!
Versión Publicado Notas de la versión
1.0.0.1

Updated license

1.0.0.0