creating several subplots with for loop
조회 수: 4 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
채택된 답변
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
추가 답변 (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!