subplot command does not work
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Omer hakan Yaran
am 25 Okt. 2021
Kommentiert: Omer hakan Yaran
am 26 Okt. 2021
Hi, I am very new to MATLAB and I am stuck on this one problem. I cannot use subplot code. Here is the ss of the error code and the source code
0 Kommentare
Akzeptierte Antwort
Dave B
am 25 Okt. 2021
Bearbeitet: Dave B
am 25 Okt. 2021
I think you wanted commas and not colons:
subplot(2,1,1)
plot(rand(1,10),'r')
title('red')
subplot(2,1,2)
plot(rand(1,10),'b')
title('infrared')
But if you're using a recent version of MATLAB (and you noted 2021b in the question), do yourself a favor and use tiledlayout/nexttile instead of subplot:
figure
t=tiledlayout(2,1);
nexttile
plot(rand(1,10),'r')
title('red')
nexttile
plot(rand(1,10),'b')
title('infrared')
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Subplots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!