Clear Filters
Clear Filters

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

2 views (last 30 days)
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 Comment
Johannes Hougaard
Johannes Hougaard on 19 Aug 2021
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.

Sign in to comment.

Answers (1)

Himanshu Jain
Himanshu Jain on 24 Aug 2021
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');

Categories

Find more on Graphics Object Properties in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!