如何通过我的代码使用 MATLAB 的数据游标

How to use MATLAB's data cursor via my code

我已经在 Matlab 中编写脚本来生成 FFT 简单的 DTMF 拨号音。这是我的情节目前的样子:

但是,我希望能够在两个最大值点添加 MATLAB 的 data cursor 功能,如下所示:

如何通过我的代码(而不是通过绘图 window)做到这一点?

datacursormode的文档中,明确表示这是不可能的:

You place data tips only by clicking data objects on graphs. You cannot place them programmatically (by executing code to position a data cursor).

但是,站点 undocumentedmatlab.com explains very precisely how to achieve that, see the page Controlling plot data-tips。有时,Matlab 帮助并没有说出全部内容...