App designerでグラフクリックをトリガーにしたい
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
qrqr
le 22 Jan 2020
Réponse apportée : Etsuo Maeda
le 31 Jan 2020
MATLAB2018bのApp designerを使い以下のようなGUIを作成しました。

この時、グラフの各データをクリックすると座標が自動で表示されますが、このクリックを起点に関数を実行することはできるのでしょうか?
また、クリックしたときの表示されてる座標を変数に格納することもできますか?
宜しくお願いします。
0 commentaires
Réponse acceptée
Musashi Ito
le 28 Jan 2020
Modifié(e) : Musashi Ito
le 28 Jan 2020
ご参考までに、はっきりした回答ではないのですが、グラフの各データをクリックすると座標が自動で表示される機能は「データ ヒント」と呼ぶらしいです。表示をカスタマイズもできそうです。
このデータ ヒントから座標値も datacursormode 関数で取得できるみたいです。
が、App Designer 上のグラフをクリックして座標値を取得して変数に格納、となると難しいかもしれません・・・
Plus de réponses (1)
Etsuo Maeda
le 31 Jan 2020
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
0 commentaires
Voir également
Catégories
En savoir plus sur Array Geometries and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!