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

39 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 22 de Ag. de 2012

Más respuestas (2)

Gourou
Gourou el 23 de Ag. de 2012
Hi,
I gonna try this evening. But it seems all good.
Thanks you so much !

Adam Danz
Adam Danz el 29 de Oct. de 2020
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 comentarios
Gopinath Karuppannan
Gopinath Karuppannan el 1 de Oct. de 2021
Is it possible to have multiple data cursor points in the same plot through programmatically?
Adam Danz
Adam Danz el 1 de Oct. de 2021
Yes, call datatip() as many times as you'd like.

Iniciar sesión para comentar.

Categorías

Más información sobre Graphics Performance en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by