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

조회 수: 13 (최근 30일)
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 !

채택된 답변

Kevin Holly
Kevin Holly 2022년 4월 25일
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
Kevin Holly
Kevin Holly 2022년 4월 26일
Did you happen to rename your UIAxes?
I created an app in R2021b (see attached) and could not replicate the issue.
Pierrekorda
Pierrekorda 2022년 4월 26일
편집: Pierrekorda 2022년 4월 26일
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!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by