click workspace variable / figure marker point to activate function

5 ビュー (過去 30 日間)
Hi has anyone tried to link entries of a variable to specific text files. Assuming there is a variable A = [2 3; 5 6], and I will want to have the ability to click on, say, 3 when I open the variable A in the workspace and automatically pick up a text file named 3 to plot? I presume I will have to write a function script for the plotting but how can I set MATLAB up in such a way that a click can activate the function. An extension is even to be able to do that when I click the marker point of a variable in a figure. Can that be done?

採用された回答

Walter Roberson
Walter Roberson 2015 年 5 月 21 日
Doing it by clicking on the number inside the workspace variable viewer is going to be difficult to find the interface for -- I don't think that level is documented (and it is probably in Java.)
Your "extension" is much easier. You can set a callback function to be activated when the line object is selected; by examining the figure CurrenPoint you can figure out where you are on the line. Or I seem to recall that datacursor() can figure out where you are. And there is also data brushing, which I am pretty sure allows you to figure out where you are on a line, but I have not researched it enough to figure out how it works.
  1 件のコメント
Bonaventure Mills-Dadson
Bonaventure Mills-Dadson 2015 年 6 月 16 日
Sorry for commenting this late. I had to take time off to work on something else. But your suggestion for using the callback feature did work. Thanks for that. I had to use the 'ButtonDownFcn' for a left mouse button click on the graph to grab the properties and plot it for me.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by