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

조회 수: 1 (최근 30일)
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 CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by