How can i create two subplot

223 views (last 30 days)
MdRezwan Parvez
MdRezwan Parvez on 23 Mar 2019
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 Comment
Lesley Chingwena
Lesley Chingwena on 1 May 2022
Hello, did you manage to find a solution for this? I am also trying to do something similar.

Sign in to comment.

Answers (1)

KALYAN ACHARJYA
KALYAN ACHARJYA on 24 Mar 2019
% 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

Tags

Community Treasure Hunt

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

Start Hunting!