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 件のコメント

A
A 2015 年 5 月 31 日
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
Walter Roberson
Walter Roberson 2015 年 5 月 31 日
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
Walter Roberson
Walter Roberson 2015 年 5 月 31 日
set(dcm_object, 'Enable', 'on')
A
A 2015 年 6 月 1 日
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.
Walter Roberson
Walter Roberson 2015 年 6 月 1 日
Short answer: use this File Exchange Contribution
Walter Roberson
Walter Roberson 2015 年 6 月 2 日
Keywords so this will get indexed by the search engine: datacursormode datatip createdatatip
A
A 2015 年 6 月 2 日
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