Replace arrays of a matrix with a vector
    3 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
Hi,
I have a matrice R like : 
    R=zeros(3);
I need to change 3 array of R:
    c=[1 1;3 2;1 2];
with new values in this vector:
    Newvalue=[ 3 7 9];
So the final result is :
    R=[3 9 0;0 0 0;0 7 0]
I know that I can do it easily with a For loop to check every element and replace new value.
But I want to vectorize this, i.e. with no loop.
0 commentaires
Réponse acceptée
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Cell Arrays 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!

