How can i create two subplot

조회 수: 46 (최근 30일)
MdRezwan Parvez
MdRezwan Parvez 2019년 3월 23일
댓글: Lesley Chingwena 2022년 5월 1일
I am using a for loop which is giving me 16 plots. I want to put 8 in one subplot and the remaining 8 in the subplot 2. i am using the following code:
models{ct} = arx(ze1,[[na1_ na2_] [nb1_ nb2_] nk]);
if ct<10
figure(1)
s(1)=subplot(3,3,ct)
else
figure(2)
s(2)=subplot(3,3,ct)
end
unfortunately after putting 3 plots in subplot 1, matlab is giving me the following error:
"Error using subplot (line 327)
Index exceeds number of subplots"
how can i generate two subplots with 8 plot in each of them.
thanks
  댓글 수: 1
Lesley Chingwena
Lesley Chingwena 2022년 5월 1일
Hello, did you manage to find a solution for this? I am also trying to do something similar.

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

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 3월 24일
% Figure 1
figure(1);
subplot(121), plot(test1);
subplot(122), plot(test2);
% Figure 2
figure(2);
subplot(121), plot(test3);
subplot(122), plot(test4);
%Please changes as per your requirements

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by