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

 채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 31일

0 개 추천

댓글 수: 8

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 2015년 5월 31일
편집: A 2015년 5월 31일
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.

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

추가 답변 (0개)

카테고리

질문:

A
A
2015년 5월 31일

댓글:

A
A
2015년 6월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by