Custom Data Cursor

버전 1.0.0.0 (2.18 KB) 작성자: Dave Van Tol
This function allows a user to label each point in a data series with custom labels.
다운로드 수: 2.5K
업데이트 날짜: 2008/5/22

라이선스 보기

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)

인용 양식

Dave Van Tol (2025). Custom Data Cursor (https://kr.mathworks.com/matlabcentral/fileexchange/18773-custom-data-cursor), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2007b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Data Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
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.