subplot command does not work
조회 수: 11 (최근 30일)
이전 댓글 표시
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
채택된 답변
Dave B
2021년 10월 25일
편집: Dave B
2021년 10월 25일
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')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!