How to insert a Data Cursor on a specif location from command ?

조회 수: 39 (최근 30일)
Gourou
Gourou 2012년 8월 22일
댓글: Adam Danz 2021년 10월 1일
Hello,
I have done some plots and I need to insert a Data Cursor to "highlight" the maximum of a curve.
Of course I could do it from the plot itself, but it would be better to do it automatically from the .m script.
Do you know how to d it ?
Thanks a lot, Bastien

채택된 답변

Sean de Wolski
Sean de Wolski 2012년 8월 22일

추가 답변 (2개)

Gourou
Gourou 2012년 8월 23일
Hi,
I gonna try this evening. But it seems all good.
Thanks you so much !

Adam Danz
Adam Danz 2020년 10월 29일
Update: as of r2019b you can use datatip(__) to programmatically place a data tip.
Demo:
fig = figure();
ax1 = subplot(1,2,1);
h1 = plot(magic(5));
datacursormode on
datatip(h1(2), 2, 5);
subplot(1,2,2)
h2 = plot(rand(10), 'sb');
datatip(h2(3),'DataIndex',5);
  댓글 수: 2
Gopinath Karuppannan
Gopinath Karuppannan 2021년 10월 1일
Is it possible to have multiple data cursor points in the same plot through programmatically?
Adam Danz
Adam Danz 2021년 10월 1일
Yes, call datatip() as many times as you'd like.

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

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by