フィルターのクリア

How to stop a plot window to open in app designer?

26 ビュー (過去 30 日間)
Ana Sofía Marulanda Duque
Ana Sofía Marulanda Duque 2019 年 9 月 4 日
コメント済み: Biruk Belay 2022 年 8 月 10 日
Hey,
I am currently working with App Designer trying to make a user interface for a Source Mesurement Unit and this is basically what i have of the interface so far.
quechimbada1.JPG
What i want is the signal to start appearing in the plots, i have the following code. I don't understand some parts of it, i found it online.
quechimbada2.JPG
Basically what happens is that the signal is plotted in the first graph but also a new window opens apart from the interface and i don't know how to make it go away and don't appear anymore. quechimbada3.JPG
I will appreciate any help with this thing and also if you could help me to understand better how the plots work it would be great. Thanks!

採用された回答

Adam Danz
Adam Danz 2019 年 9 月 4 日
編集済み: Adam Danz 2020 年 10 月 8 日
This line is opening a new plot;
ax = gca;
gca() returns the current axis but since the default HandleVisibility for uifigures is set to "off", gca cannot access the app's axis handle so it creates a new figure and axis.
Use the axis handle instead (example: app.UIAxis).
Some functions use gca by default if the axis handle isn't provided. Specify the axis handle in all graphics functions that permit it. That inlcudes datetick().
  2 件のコメント
Ana Sofía Marulanda Duque
Ana Sofía Marulanda Duque 2019 年 9 月 10 日
i deleted the gca() function but it is still appearing, anyways thank you <3
Adam Danz
Adam Danz 2019 年 9 月 10 日
What's happening in outputSingleScan() and inputSingleScan()? I wonder if the additional axes are being created in there.
datetick should have the axis handle input
datetick(app.Plot2, 'x', 'keeplimits')
Other than that, I can't imagine what else would create a new axes from the snippet of code you shared.

サインインしてコメントする。

その他の回答 (2 件)

Ali Mostaed
Ali Mostaed 2020 年 10 月 8 日
I had this issue and could not figure out what was the source of that. It's funny that the blank figure does not pop up if you run the code in the command window, but it does inside the app!! Finally I resolved it by adding "close(gcf)" at the end
  1 件のコメント
Adam Danz
Adam Danz 2020 年 10 月 8 日
Well, that closes the figure that was incorrectly opened. Instead, supply the figure or axis handle to whatever function is opening that figure instead of using the default gca/gcf/

サインインしてコメントする。


Biruk Belay
Biruk Belay 2022 年 8 月 9 日
For me it worked this way: I included this code right before the main UIAxes
fig1 = figure();
set(fig1, 'Visible', 'off'); % removes the default figure pop-up during live plot.
  2 件のコメント
Adam Danz
Adam Danz 2022 年 8 月 9 日
Instead of generating the visible figure and then turning visibility off, you could generate the figure with visibility off to begin with.
fig1 = figure('visible','off');
Biruk Belay
Biruk Belay 2022 年 8 月 10 日
Yes, that is a better way of writing it. Thanks!!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by