using app designer, am trying to plot in new figure once the checkbox for that is selected.

1 回表示 (過去 30 日間)
Hajar Abdullah
Hajar Abdullah 2021 年 8 月 18 日
回答済み: Himanshu Jain 2021 年 8 月 24 日
function PLOTButtonPushed(app, event)
figure;
plot(x, y, 'Color', str_color); %plot graph
title(app.EditField.Value);
end
this function starts ploting from figure 2 not 1 ans so on. and i want that each time i press the plot button it should plot again in new figure (continuing from last figure) and s on.
  1 件のコメント
Johannes Hougaard
Johannes Hougaard 2021 年 8 月 19 日
I can't recreate your problem unfortunately.
In this app all I've done is to make the button you describe - and it works as you describe that the first figure is figure 1, the next is figure 2 etc.

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

回答 (1 件)

Himanshu Jain
Himanshu Jain 2021 年 8 月 24 日
Do you want the plot to replace what is already there and keep the same axes? You can do it in the following way.
h1 = figure;
plot(randn(100,1));
figure(h1)
ax = gca;
plot(ax,randn(100,1),'r');
Or do you want the plot to be in addition to what is there with the same axes? In this case you can use 'hold on' functionality and do it in the following way.
h1 = figure;
plot(randn(100,1));
figure(h1)
ax = gca; hold on;
plot(ax,randn(100,1),'r');

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by