필터 지우기
필터 지우기

Custom datatip not updated

조회 수: 14 (최근 30일)
Frank Herzog
Frank Herzog 2019년 4월 24일
답변: Frank Herzog 2020년 10월 19일
I have created an image with a custom datatip update function:
h = image([1 2; 3 4]);
f = get(get(h, 'Parent'), 'Parent');
dcm = datacursormode(f);
set(dcm, 'UpdateFcn', @(~, event) num2str(event.Target.CData(event.Position(2), event.Position(1))));
dTip = createDatatip(dcm, h);
dTip.Position = [1 1];
So far, this works as expected. However, when I change the underlying CData:
set(h, 'CData', [100 2; 3 4]);
then the datatip is not automatically updated (datatip value remains at 1). With the standard update function, the datatip window is automatically updated. E.g.:
set(dcm, 'UpdateFcn', '');
set(h, 'CData', [200 2; 3 4]);
The datatip will automatically change to 200.
How can I implement an automatically updating datatip window with a custom datatip function?

채택된 답변

Frank Herzog
Frank Herzog 2019년 4월 26일
If anybody else has this problem, this call updates the datatip:
dcm.updateDataCursors;
  댓글 수: 1
Andrea
Andrea 2020년 1월 16일
Very useful. Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Frank Herzog
Frank Herzog 2020년 10월 19일
It seems that this issue is resolved in R2020a. The custom datatip is now automatically updated.

카테고리

Help CenterFile Exchange에서 Display and Exploration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by