フィルターのクリア

write a coordinate obtained by clicking on a graphic appdesigner

3 ビュー (過去 30 日間)
Marina Llopis Segura
Marina Llopis Segura 2023 年 4 月 4 日
Good morning, I have a code that, inside a graph follows the movement of the mouse and when you click it saves the x and y coordinates of that point. Later I want to write that x-coordinate in an edit field numeric. The code I have is the following but I have something wrong. I would appreciate if someone could help me.
properties (Access = private)
x
y % Description
end
app.time is the name of the edit field numeric and acc_x the name of the uiAxes

採用された回答

Kevin Holly
Kevin Holly 2023 年 4 月 7 日
編集済み: Kevin Holly 2023 年 4 月 7 日
It looks like your callback event "WindowMousePress" may not be triggered. You could add a callback function to your UIAxes as such:
function UIAxesButtonDown(app, event)
currentPoint1 = app.UIAxes.CurrentPoint(1,1:3);
x1 = currentPoint1(1);
app.tiempo.Value = x1;
end

その他の回答 (1 件)

Antoni Garcia-Herreros
Antoni Garcia-Herreros 2023 年 4 月 4 日
編集済み: Antoni Garcia-Herreros 2023 年 4 月 4 日
Hello Marina,
Looks good to me except the last line, I would change it to:
app.tiempo.Value = app.x; % CurrentPoint(1) is already a numeric value
Hope this helps
  1 件のコメント
Marina Llopis Segura
Marina Llopis Segura 2023 年 4 月 4 日
I had also thought about it but even though it doesn't give me an error when I click on it, I get a zero in the edit field and it doesn't change.

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

カテゴリ

Help Center および File ExchangeHistorical Contests についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by