How can I Save a matrix generated from for loop into an array

I have been trying to save the data generated in the Hinge matrix for the four for loops in an array consist of 10,000 page where each page contains the 4x4 Hinge matrix generated inside the four for loops. There are four for loops for 10 preceding variables so the total result is 10^(4) solutions possible for the Hinge matrix.
Q=23;
F=67'
for Y=2:4:38;
for W=-188:13:-71;
for G=77:18.64:244.76;
for P=0.5:0.0112:0.6008;
Hinge=[Y+W, Y+G, Y+Y, Q;
Y+21-W*G, G+11.88*F, Q, F;
F+Q+W, F*G*W, F*1.88*P, P;
0, 0, 0, 1];
end
end
end
end

 Réponse acceptée

Q=23;
F=67 ;
Hinge = zeros(4,4,[]) ;
count = 0 ;
for Y=2:4:38;
for W=-188:13:-71;
for G=77:18.64:244.76;
for P=0.5:0.0112:0.6008;
count = count+1 ;
Hinge(:,:,count)=[Y+W, Y+G, Y+Y, Q;
Y+21-W*G, G+11.88*F, Q, F;
F+Q+W, F*G*W, F*1.88*P, P;
0, 0, 0, 1];
end
end
end
end

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Produits

Version

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by