How to increment matrix row only inside a nested for loop?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
for i= 1:10{
for j= 1:5{
x = i*j;
mat
}}
matrix's row number index row wise should increment by 1
save this x value in mat matrix's row wise(like 1st row,2nd row,...,50th row).
Please help
4 commentaires
Réponses (1)
Bob Thompson
le 7 Nov 2019
The solution is indexing. You can do math in your index if you need to.
x((i-1)*5+j) = i*j;
0 commentaires
Voir également
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!