Create data tips at multiples points on a figure programatically

18 visualizzazioni (ultimi 30 giorni)
I have a matrix "MyData" with size 592 by 1. After plotting I want to place datatips at 2 points. How can I create datatips programatically?
My code is
figure (1)
plot(MyData)
X_r1 = ((l +0.15)*8)/0.05 % X_r1 and X_r2 are calculated from 'l' which I input while running the code
X_r2 = (((l +0.15)*8)/0.05) + ((2*l+0.15)/0.05)
I want to crate datatips at X_r1 and X_r2! How can I create? Thank you.

Risposte (1)

Walter Roberson
Walter Roberson il 27 Mag 2017
h = plot(MyData);
X_r1 = ((l +0.15)*8)/0.05 % X_r1 and X_r2 are calculated from 'l' which I input while running the code
X_r2 = (((l +0.15)*8)/0.05) + ((2*l+0.15)/0.05);
dcm_obj = datacursormode();
createDatatip(dcm_obj, h, [l, X_r1]);
createDatatip(dcm_obj, h, [l, X_r2]);

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by