App designerでグラフクリックをトリガーにしたい
古いコメントを表示
MATLAB2018bのApp designerを使い以下のようなGUIを作成しました。

この時、グラフの各データをクリックすると座標が自動で表示されますが、このクリックを起点に関数を実行することはできるのでしょうか?
また、クリックしたときの表示されてる座標を変数に格納することもできますか?
宜しくお願いします。
採用された回答
その他の回答 (1 件)
Etsuo Maeda
2020 年 1 月 31 日
x = rand(10, 2);
scatter(x(:, 1), x(:, 2))
do = datacursormode(gcf);
do.UpdateFcn = @myFun;
function output_txt = myFun(~, event)
pos = get(event, 'Position');
output_txt = {['X: ', num2str(pos(1))], ['Y: ', num2str(pos(2))]};
disp(pos)
end
HTH
カテゴリ
ヘルプ センター および File Exchange で Array Geometries and Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!