defining a vector with vector of indices
12 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all
I have a vector zero of size M called A, also I have another vector of size 4 that its arrays are integers among 1 to M called B. now I want to put some values in arrays of A with indeces in B, I.e I want to put values in 4 place of A, that these places are defined via B, for instace:
A=zeros(8,1), and B=[ 1 3 4 5], I want to put some defined numbers in positions 1, 3, 4 and 5 of A, how I can do that?
is there anyone to help me?
Thank you
0 commentaires
Réponse acceptée
Plus de réponses (1)
Andrei Bobrov
le 26 Déc 2012
Modifié(e) : Andrei Bobrov
le 26 Déc 2012
A(B) = C;
here C - with size(C) = [1,1] or numel(C) == numel(B)
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices 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!