フィルターのクリア

creating several subplots with for loop

3 ビュー (過去 30 日間)
Thomas Fogarty III
Thomas Fogarty III 2016 年 2 月 26 日
コメント済み: Thomas Fogarty III 2016 年 2 月 28 日
I'm trying to take data that is 86 rows long and generate a series of subplots. The code would generate 5 subplots per figure and repeat such that the first would be rows 1-5, second rows 6-10, etc. Ex.
Fig1
a = row 1
b = row 2
c ...
e = row 5
I have been able to generate this plot manually for 5 rows at a time; i want to loop this script to generate sets of 5 subplots per figure until all rows have been plotted.
The code I used to generate the 5 rows successfully is as follows:
start = 1
finish = 5
rows = finish - start
figure
for i = start:1:finish
hold on
subplot(rows+1,1,i);
plot(chan1(i,2:end));
end
Any suggestions on how to expand this to run all the data at once would be greatly appreciated!

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 2 月 26 日
t=1:100;
y=rand(80,100);
for k=1:5:size(y,1);
s=y(k:k+4,:);
figure;
for ii=1:5
subplot(5,1,ii);
plot(t,s(ii,:))
end
end
  1 件のコメント
Thomas Fogarty III
Thomas Fogarty III 2016 年 2 月 28 日
thanks - looks like it works perfectly! much appreciated!

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

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by