Custom Data Cursor

This function allows a user to label each point in a data series with custom labels.
2,5K Descargas
Actualizado 22 may 2008

Ver licencia

customDataCursor allows a user to label each point in a data series with custom labels. When the data cursor mode is enabled (DATACURSORMODE ON), clicking on a data point will display the custom label, then the x and y values of the data point. If more than one data point of the data series is in the same location, the data cursor will display all of the labels first, then the x and y locations.

Usage: customDataCursor(H,DATALABELS) applies the custom labels found in cell array DATALABELS to the line with handle H. DATALABELS must be a cell array with the same length as 'XDATA' and 'YDATA' in the line; in other words, there must be a label for each data point in the line.

dcmH = customDataCursor(H,DATALABELS) returns the handle to the data cursor in dcmH.

Note: CUSTOMDATACURSOR uses the 'UserData' property of a line to store and retrieve the labels. If that property is used by another portion of a user's program, this function may be broken, or this function may break the user's program.

Example:
% generate some data and chart it
N = 20;
x = rand(N,1);
y = rand(N,1);
h = plot(x,y,'ko');
% make up some labels and apply them to the chart
labels = cell(N,1);
for ii = 1:N
labels{ii} = ii;
end
customDataCursor(h,labels)

Citar como

Dave Van Tol (2025). Custom Data Cursor (https://la.mathworks.com/matlabcentral/fileexchange/18773-custom-data-cursor), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2007b
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.

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.0

Modified code to fix bug reported by Ahmed Andalusi. Although I could not recreate the error message reported, I think I understand the offending line of code and have changed it to use a cell array rather than a string array. Thanks, Ahmed.