UIAxes CurrentPosition Bug on Matlab2022B (Was working fine on 2020B)

1 回表示 (過去 30 日間)
FURKAN TULUK
FURKAN TULUK 2024 年 5 月 28 日
コメント済み: FURKAN TULUK 2024 年 5 月 31 日
Hello, I have an Appdesigner application and I plot data on UIAxes in my application. I click on the UIAxes plot to pick a point and press a button in UIFigure to find the CurrentPosition of that point, but since it conflicts with UIFigure's CurrentPosition, I find a value independent of UIAxes based on the current position of my mouse. This problem did not exist in Matlab 2020B, but I encountered this situation when I switched to 2022B. How can I solve this problem?

回答 (1 件)

Sarthak
Sarthak 2024 年 5 月 30 日
This is interesting. If there is a conflict between the CurrentPosition of UIAxes and UIFigure in MATLAB 2022B, it could be because how CurrentPosition used to be handled has changed.
As a workaround, you can try to create a callback function for the ButtonDownFcn event of the UIAxes. This function will be executed when you click on the UIAxes, and it can store the CurrentPoint property of the UIAxes in a separate variable.
Now, when you press the button in UIFigure, you can access the CurrentPoint of the UIAxes from the handles structure, instead of using the CurrentPosition property of the UIFigure.
Please note that this is a workaround, and it might not work in all situations. Reaching out to MathWorks Technical Support might be a good idea. In case you do, let me know the right way to do it as well. Otherwise the above mentioned workaround should work fine.
  1 件のコメント
FURKAN TULUK
FURKAN TULUK 2024 年 5 月 31 日
Hello, I created ButtonDownFcn for UIAxes and the problem was solved. Thanks

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

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by