Applying hold in multiple figure window??

조회 수: 14 (최근 30일)
Nilakantha Meher
Nilakantha Meher 2017년 4월 4일
댓글: Nilakantha Meher 2017년 4월 4일
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
Nilakantha Meher
Nilakantha Meher 2017년 4월 4일
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:')

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2017년 4월 4일
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
Nilakantha Meher
Nilakantha Meher 2017년 4월 4일
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:')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by