Referring to multiple columns
34 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
mat =
7 8 9 10
12 10 8 6
How can I refer to the first two columns of the matrix above? Thanks in advance.
0 commentaires
Réponse acceptée
Geoff Hayes
le 10 Sep 2015
Ahmet - if mat is your matrix, then to get the first two colums (and all rows) you could do
mat(:,1:2)
which would give you
7 8
12 10
Note how the first colon indicates that we want all rows, and the 1:2 means that we want the columns one through two.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical 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!