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

 Réponse acceptée

8 commentaires

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 le 31 Mai 2015
Modifié(e) : A le 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.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by