How can I use DATACURSOR to I extract data visually from three plots simultaneously?
4 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2013 年 10 月 25 日
編集済み: MathWorks Support Team
2025 年 10 月 10 日
How can I use DATACURSOR to I extract data visually from three plots simultaneously?
Requirements:
1) All three images are displayed as sublots on the same figure
2) Be able to click on any of the three figures and have MATLAB automatically mark the corresponding location on all three plots
3) Be able to extract the x- and y-coordinates of the selected point to the MATLAB workspace
採用された回答
MathWorks Support Team
2025 年 10 月 10 日
編集済み: MathWorks Support Team
2025 年 10 月 10 日
Unfortunately, DATACURSOR does not provide this functionality. In order to achieve this goal, you will need to create function callbacks associated with the figure itself. Upon clicking on an image, the callback function will be executed and perform the necessary procedures to fulfill your requirements.
Please refer to the following documentation for writing code for use with callbacks:
An example code is attached to this solution to illustrate how callback functions are used. The attached example code (TripleExtract.m) should display the functionality you are interested in.
Some key notes for the example code:
1) The example code is heavily commented to make it easier to understand how the callback functions work.
2) The function intentionally returns a NaN result, but updates the value after you have selected a point on the figure. The default return value can be adjusted within the function.
3) Since DATACURSORMODE cannot be used in conjunction with certain callback properties, the function is written to display the selected coordinates and values every time the figure is clicked. Using this display, you should be able to determine which point you are looking for.
4) In order to pass data out of the function after it has run, a handle class named “PointClass” (PointClass.m) was created. Please refer to the following documentation to better understand handle classes:
5) One key way to pass data between subfunctions within an app is to store the data using SETAPPDATA and retrieve the data using GETAPPDATA. Please refer to the following documentation to better understand how this works:
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Environment and Settings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!