How can i create two subplot

46 visualizzazioni (ultimi 30 giorni)
MdRezwan Parvez
MdRezwan Parvez il 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 Commento
Lesley Chingwena
Lesley Chingwena il 1 Mag 2022
Hello, did you manage to find a solution for this? I am also trying to do something similar.

Accedi per commentare.

Risposte (1)

KALYAN ACHARJYA
KALYAN ACHARJYA il 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

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by