How can I write a matrix 6x1 that the element (2,1) and (6,1) equal to 1 and others are zero?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
reza dehghan
le 8 Oct 2014
Commenté : Star Strider
le 8 Oct 2014
like this : 0 1 0 0 0 1
0 commentaires
Réponse acceptée
Star Strider
le 8 Oct 2014
If the vector is ‘A’, this works:
A([2 6]) = 1;
produces:
A =
0 1 0 0 0 1
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Multidimensional 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!