How to change array element with another array
Afficher commentaires plus anciens
hi all, so i have 2 array and i want to change the value of array1 to array2. for example i have:
a = [1 1 1; 1 1 1; 1 1 1]
b = [4 4; 4 4]
and i want the array to be like this :
c = [4 4 1; 4 4 1; 1 1 1]
basicaly i want 'b' to be inside 'a' and replace all element 'a' in the same position as 'b' hehe what is the simplest code for this? thanks
Réponse acceptée
Plus de réponses (1)
Andrei Bobrov
le 4 Déc 2014
n = size(b);
c = a;
c(1:n(1),1:n(2)) = b;
Catégories
En savoir plus sur Vehicle Dynamics Blockset dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!