How to change the parameters of a loop

1 visualización (últimos 30 días)
Hinde essmahi BOUZIANE
Hinde essmahi BOUZIANE el 1 de Jul. de 2019
Comentada: Hinde essmahi BOUZIANE el 2 de Jul. de 2019
I have an array of 85 doubles and i want to browse the array 9 by 9 (ie: for i=1:9).I want to plot then the results in a figure (3*3).
figure;
for j=1:9
BinData=ExtractContinuousData([],Info,[7],Start(1,j),End(1,j),[]);
[S1,t,f]=mtspecgramc(BinData);
subplot(3,3,j)
plot_matrix(S1,t,f);xlabel([]);
end
%Start and Debut are the arrays that contains the 85 doubles each
But the problem is I just can plot the first 9 elements.How can I change each time to see the others elements?
  2 comentarios
Stephen23
Stephen23 el 2 de Jul. de 2019
@Hinde essmahi BOUZIANE: your question is not very clear: what is the exact size of the input array/s ? You write that "I have an array of 85 doubles and i want to browse the array 9 by 9", but 85 does not divide into 9 without some remainder: do you want to split the 85 elements into blocks of the same size, or different sizes, or have some left over?
It might help if you show us a small example of what you are trying to achieve, with both input and output example arrays.
Hinde essmahi BOUZIANE
Hinde essmahi BOUZIANE el 2 de Jul. de 2019
The size of the array might change depending on the DATA I have.So I could have some left overs when i split the elements of the array.
The problem is when I want to browse for example the 10th element (j=10), the command plot(3,3,j) wouldn(t work because the maximal value that j can take in this case is 9.
NB: the output is 9 curves

Iniciar sesión para comentar.

Respuestas (1)

gonzalo Mier
gonzalo Mier el 1 de Jul. de 2019
figure;
for i=1:9
A(((i-1):i)*9+1) = instructions(i)
plot(A(((i-1):i)*9+1))
end

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by