ginput occasionally not displaying cursor on app.UIFigure or UIAxes (App Designer)

5 visualizzazioni (ultimi 30 giorni)
Has anyone else had issues with the functionality of ginput with app designer created figures? On seemingly random occasions when ginput is called, the "mouse" pointer predictabily dissappears, but the crosshairs do not appear, leaving the user blind as to where they are on the figure. When this occurs, there appears to be no way to correct it other than to restart the application and losing all progress. The inputs DO still register when the user clicks on the figure though! There are also no errors when the callback is run and the line function run after with these inputs (shown below) will plot on the axes.
I have tried setting the handle visibility to 'callback' and specifying the current figure to try to "point" the function to the app figure, but this hasn't prevented the issue.
For additional context, what I am doing is receiving user input of a range of X values on a 1D plot or 2D matrix, plotted on an app.UIAxes, and store the info in a cell array. The user must cycle through multiple plots/matrices and the app updates the values as they are changed. "r" is the index of the plot they are on, and "e" is the index of the selected input range. The user can add multiple "e"s (input ranges) through an add tool which also utilizes the ginput function.
I have used ginput in a number of ways to collect input on matrices/images as well, and frequently encounter this issue. I'm aware there is a separate selection tool on the axes object however I don't know how to use it accordingly to programmatically recieve the values in a callback.
function EditPointsButtonPushed(app, event)
r = app.r;
e = app.e
assert(~verLessThan('Matlab', '9.9'), 'ginput not supported prior to Matlab r2020b.')
fhv = app.UIFigure.HandleVisibility
app.UIFigure.HandleVisibility = 'callback'
set(0, 'CurrentFigure', app.UIFigure)
[X1 ~] = ginput(2)
app.UIFigure.HandleVisibility = fhv;
line([X1(1) X1(1)],[Ymin max(app.Eventplots{r,e}(:,2))]); %1 needs to be axis min
line([X1(2) X1(2)],[Ymin max(app.Eventplots{r,e}(:,2))]);
app.Editpoints = round(X1)
end
I should also mention that the app is structured with a gridlayout, with panels that contain the axes. I thought that possibly ginput was occasionally being called onto the figure underneath these panels, however as others have mentioned in other questions, you cannot specify ginput onto objects/axes/etc and I cannot see the cursor when I move it between panels. I'm not sure what else to try, so any ideas would be greatly appreciated!!

Risposte (1)

Pavan Sahith
Pavan Sahith il 2 Lug 2024
Modificato: Pavan Sahith il 3 Lug 2024
Hello Blaine,
I see that you are experiencing an issue where ginput occasionally does not display the cursor on an App UIFigure or UIAxes in App Designer.
Please ensure that you are using a version of MATLAB that supports ginput in App Designer, as this feature is supported starting from R2020b.
You can verify this information in the release notes for MATLAB R2020b:
you can also refer to similar MATLAB answer posrts which might be helpful
For more detailed information , you can refer to the following MathWorks documentation:
Hope this information helps you in moving forward.

Categorie

Scopri di più su Develop uifigure-Based Apps in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by