creating several subplots with for loop
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Thomas Fogarty III
el 26 de Feb. de 2016
Comentada: Thomas Fogarty III
el 28 de Feb. de 2016
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 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 26 de Feb. de 2016
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
Más respuestas (0)
Ver también
Categorías
Más información sobre Subplots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!