UIAxes CurrentPosition Bug on Matlab2022B (Was working fine on 2020B)
2 views (last 30 days)
Show older comments
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?
0 Comments
Answers (1)
Sarthak
on 30 May 2024
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.
See Also
Categories
Find more on Develop uifigure-Based Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!