how to display output of all iteration of for loop in a matrix or even a array

4 vues (au cours des 30 derniers jours)
a=[1 2 3 4 5 6 7 8 9 0]
for i=1:2:7
b=a(1,i:i+3)
end
this is the code i hve written,now i want this output in the form of a matrix. can someone help

Réponse acceptée

Thomas
Thomas le 4 Fév 2014
a=[1 2 3 4 5 6 7 8 9 0]
count=1;
for i=1:2:7
b(count,:)=a(1,i:i+3);
count=count+1;
end
b

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by