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

13 ビュー (過去 30 日間)
Pierrekorda
Pierrekorda 2022 年 4 月 25 日
編集済み: Pierrekorda 2022 年 4 月 26 日
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 Center および File ExchangeInteractive 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