subplot command does not work

4 ビュー (過去 30 日間)
Omer hakan Yaran
Omer hakan Yaran 2021 年 10 月 25 日
コメント済み: Omer hakan Yaran 2021 年 10 月 26 日
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

採用された回答

Dave B
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')
  1 件のコメント
Omer hakan Yaran
Omer hakan Yaran 2021 年 10 月 26 日
it works! thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubplots についてさらに検索

タグ

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by