UIAxes CurrentPosition Bug on Matlab2022B (Was working fine on 2020B)
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!