Using for loops to subplot

4 ビュー (過去 30 日間)
Erfan Parviz
Erfan Parviz 2022 年 12 月 20 日
編集済み: Star Strider 2022 年 12 月 20 日
Let's assume that I have 25 column and 3600 rows.
x = linspace (1,3600,3600); and my y is the values in my 3600 rows.
Now I want to subplot all 25 columns using for loops. How do I do?

回答 (1 件)

Star Strider
Star Strider 2022 年 12 月 20 日
編集済み: Star Strider 2022 年 12 月 20 日
One approach —
x = linspace (1,3600,3600);
y = randn(3600, 25);
figure
for k = 1:size(y,2)
subplot(5, 5, k)
plot(x, y(:,k))
title(sprintf('Column %2d',k))
end
Make appropriate changes to work with your data.
EDIT — Corrected typographical errors.
.

カテゴリ

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