Effacer les filtres
Effacer les filtres

transfer from fix array to another array

2 vues (au cours des 30 derniers jours)
HASAN AL-KAF
HASAN AL-KAF le 28 Août 2017
Modifié(e) : KL le 28 Août 2017
Hi I have this code below.I Want to store what will come in w((1),:) in another array called M((N),:) for 113 iteration. For example, in iteration one in w((1),:) store in M((1),:) , w((1),:) store in M((2),:) and w((1),:) store in M((3),:) and so on until reach to N Which is 113 N=113 for i = 1:N for j= 1: N E(j) = y((j),:)-w((1),:)*x(: , (j)) ; w((1),:)=w((1),:)+E(j)*0.01*z((j),:) ; end end

Réponse acceptée

KL
KL le 28 Août 2017
M = repmat(w(1,:),N,1);
  1 commentaire
KL
KL le 28 Août 2017
Modifié(e) : KL le 28 Août 2017
As Stephen says it's not clear what do you need. what do you mean by "array 1" and "array 2" of the matrix M? I suppose you refer to the rows of matrix M but anyway the result is the same just without any iterations. If you really want to have a loop
for rowNo = 1:N
M(rowNo,:) = w(1,:);
end

Connectez-vous pour commenter.

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