这是从别人那转来的,我的例子在http://hi.baidu.com/aragon2/blog/item/d551b79221edbc99a877a433.html,简单地说就是用全局变量调出datacursor的position
由于之前的不认真,少看了一篇help导致未能利用data cursor获取guide 中axes中对象的坐标,用ginput代替,很是蹩脚。现在终于吃透data cursor。总结下来,助同道人一臂之力!
先看help里面有关文章。第一篇:介绍data cursor是什么,及都有哪些功能。
Data Cursor (help 中搜索关键字)— Displaying Data Values Interactively
What Is a Data Cursor?
Enabling Data Cursor Mode
Display Style — Datatip or Cursor Window
Selection Style — Select Data Points or Interpolate Points on Graph
Exporting Data Value to Workspace Variable
第二篇:在MATLAB新版本里用户可定制data cursor功能
Data Cursor Text Can Now Be Programmatically Modified
You can now easily customize the text of datatips. The datacursormode function lets you specify the contents and formatting of text displayed by the data cursor tool. When the data cursor tool is active, you can use its context (right-click) menu to edit or specify the text update function that MATLAB executes to display datatips. For more information, see Data Cursor — Displaying Data Values Interactively in the MATLAB Graphics documentation and datacursormode in the MATLAB Function Reference documentation.
第三篇:核心部分:如何在自己的程序中使用及定制data cursor功能。
datacursormode(help 中搜索关键字)
Enable or disable interactive data cursor mode
GUI Alternatives
Use the Data Cursor tool to label x, y, and z values on graphs and surfaces. For details, see Data Cursor — Displaying Data Values Interactively in the MATLAB? Graphics documentation.
中文翻译部分之后附上!