How can I stop imagesc from opening empty figure windows in app designer ?

12 vues (au cours des 30 derniers jours)
Hello !
I'm currentlly having issues with the imagesc command. I use this function to display with specific coordinates an image behind a plot in a UIAxes. However, everytime the imagesc function is called, an additional and unwanted empty figure window is created. (The wanted image is correctly displayed where it should be though)
This is very similar to the behaviour when one forgets to give the handle of the UIAxes like by using:
hold on;
instead of
hold(app.UIAxes, "on");
The syntax I use is the following:
I = imread('image_name.PNG');
imagesc(app.UIAxes, [Xmin Xmax],[Ymin Ymax],I);
To be exact it is more like:
I = imread('image_name.PNG');
uistack(imagesc(app.UIAxes, [Xmin Xmax],[Ymin Ymax],I),'bottom');
But the presence of uistack does not change the behaviour described here.
Does someone have an idea? This is beginning to driving me crazy. Thank you !

Réponse acceptée

Kevin Holly
Kevin Holly le 25 Avr 2022
If you look at the documentation for uistack, it states, "The uistack function is not supported in App Designer or in apps created using the uifigure function. Instead, modify the stacking order of components in a container by setting the Children property of the container. For more information, see Change Front-to-Back Component Order."
  3 commentaires
Kevin Holly
Kevin Holly le 26 Avr 2022
Did you happen to rename your UIAxes?
I created an app in R2021b (see attached) and could not replicate the issue.
Pierrekorda
Pierrekorda le 26 Avr 2022
Modifié(e) : Pierrekorda le 26 Avr 2022
The UIAxes has not been renamed. I tried to copy paste your portion of the code to see if I had overlooked an error in the syntax but without much success as the problem still occur.
I, as well, didn't manage to replicate the issue even when by modifying your app and playing with the layout and properties.
I am 100% certain the empty figure window pops up from this line. I will keep looking for it, in the meantime I used:
delete(findall(groot, 'Type', 'figure', 'Number', 1));
To get rid of the undesirable figure, it's not pretty but it works for the time being.
If I ever find the solution I will update this post for future reference. Thank you for the valuable time you took!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Interactive Control and Callbacks dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by