Effacer les filtres
Effacer les filtres

how to use for loop on both sides?

1 vue (au cours des 30 derniers jours)
Jisu Yang
Jisu Yang le 27 Mai 2019
Commenté : Jisu Yang le 27 Mai 2019
I want a and b are also in loop like:
for a = 1:4
for b = 1:4
how can I use 'for' loop on both sides?
what I wrote is :
for q = [i,j,k,l]
for w = [i,j,k,l]
k_Global[q,w] = k_global[a,b]
end
end

Réponses (1)

KSSV
KSSV le 27 Mai 2019
a = 1:4 ;
b = 1:4 ;
q = [i,j,k,l] ;
w = [i,j,k,l]
for loop1 = 1:4
for loop2 = 1:4
k_Global[q(loop1),w(loop2)] = k_global[a(loop1),b(loop2)]
end
end
  1 commentaire
Jisu Yang
Jisu Yang le 27 Mai 2019
Thx a lot!!! :)
It works well!!!!
Thx!!!!

Connectez-vous pour commenter.

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