Hello all, my .m file includes multiple plots. When I run the code only the last plot figure shows up and overwrites all previous plots. Any suggestion on how to manage this ?
Many thanks

1 Kommentar

jonas
jonas am 3 Sep. 2018
Bearbeitet: jonas am 3 Sep. 2018
How do you initate a figure? Some code would be useful here.

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

Gabor Balazs
Gabor Balazs am 3 Sep. 2018

0 Stimmen

Your first plot command opens a figure and all following plot commands update that figure. To open new figure windows, use
figure()
for each window you want to open.
figure(1)
plot(1:10)
figure(2)
mesh(randn(10))

Weitere Antworten (2)

Dimitris Kalogiros
Dimitris Kalogiros am 3 Sep. 2018

0 Stimmen

Before using plot() command you should place a "figure" command
For example:
clc; clear; close all;
t=0:0.1:10;
x=sin(2*pi*3.*t);
y=sqrt(t)+cos(2*pi.*t);
figure;
plot(t,x,'-b'); zoom on; grid on;
figure;
plot(t,y,'-r'); zoom on; grid on;
D.J
D.J am 3 Sep. 2018

0 Stimmen

Wonderful, thanks a lot for your quick help !

Kategorien

Mehr zu Data Exploration finden Sie in Hilfe-Center und File Exchange

Gefragt:

D.J
am 3 Sep. 2018

Beantwortet:

D.J
am 3 Sep. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by