Applying hold in multiple figure window??

6 Ansichten (letzte 30 Tage)
Nilakantha Meher
Nilakantha Meher am 4 Apr. 2017
Dear all, I have plotted 4 different curves in 4 different windows using figure(1), figure(2), figure(3), figure(4). I want to apply 'hold' on every figure windows such that I can plot some other curves on each. If I use 'hold', Matlab is holding only figure(1) and not to others.
  1 Kommentar
Nilakantha Meher
Nilakantha Meher am 4 Apr. 2017
We need to use 'hold on' for both the figure window. One example below.........
S=[1;2;3;4;5;6;7;9;8;10];
H=[1;5;3;4;6;6;4;2;2;3];
T=[1:10];
figure(1)
hold on
plot(T,S)
figure(2)
hold on
plot(T,H)
Now for next plot on both windows with holding we can plot....
figure(1)
plot(T,H,'r:')
figure(2)
plot(T,S,'k:')

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 4 Apr. 2017
f1 = figure(1) ;ax1 = axes ;hold(ax1,'on')
f2 = figure(2) ;ax2 = axes ; hold(ax2,'on')
for i = 1:5
plot(ax1,rand(10,1))
plot(ax2,rand(10,1))
end
  1 Kommentar
Nilakantha Meher
Nilakantha Meher am 4 Apr. 2017
Thank you for your Answer......... it works. But figure(1) showing two x-axis and y-axis scale due to the command 'axes'. it is taking default axis scales 0:1. But I could find the solution of holding in multiple figure window...... We need to use 'hold on' for both the figure window. One example below.........
S=[1;2;3;4;5;6;7;9;8;10];
H=[1;5;3;4;6;6;4;2;2;3];
T=[1:10];
figure(1)
hold on
plot(T,S)
figure(2)
hold on
plot(T,H)
Now for next plot on both windows with holding we can plot....
figure(1)
plot(T,H,'r:')
figure(2)
plot(T,S,'k:')

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by