How to add a data cursor to a 3d surface which only shows the 'Z-value'?

Hi guys,
Imagine I have a very simple: surf(peaks) 3d surface.
I would like to show a tiny pop-up window for a given x and y coordinate which only shows the 'Z' value? and it would be great if I can give the 'Z' a custom name.. such as "Monthly Income" for example.
Does this make sense?
Thank you

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 31 Mai 2015

0 Stimmen

8 Kommentare

Thank you Walter. Any chance you could give me a sample code? I'm a bit of a noob. I'm not sure how I can tell matlab to put up a data cursor at x,y and only have it show me the Z value and also give me the option to call the z value something else?
Thank you
Have a look at the last example at http://www.mathworks.com/help/matlab/ref/datacursormode.html as it shows a custom update function that uses different wording.
A
A am 31 Mai 2015
Bearbeitet: A am 31 Mai 2015
Thanks so much. I almost have it working. The only thing is.. is there a way for the data cursor to already be showing when you graph it (i.e., add it programmatically at a specific x,y rather than click it with your mouse?)?
Thanks
Hi Walter,
That just allows for the mouse to click on the figure to create a data cursor. I'm looking for a way for the data cursor to already be there without having to click at a particular x,y,z value. Also, I want to lock this so that the user is not able to click elsewhere with the mouse and get a new data cursor at another position. Hope this makes sense.
Keywords so this will get indexed by the search engine: datacursormode datatip createdatatip
Done. Thanks. Will check out the link.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Gefragt:

A
A
am 31 Mai 2015

Kommentiert:

A
A
am 2 Jun. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by