what does A(3, :) mean or A(:, 3)?
91 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Patrick Lydon
le 15 Juin 2017
Réponse apportée : Philip Abel
le 23 Oct 2022
Question says it all
0 commentaires
Réponse acceptée
James Tursa
le 15 Juin 2017
Modifié(e) : James Tursa
le 15 Juin 2017
If A is a 2D matrix, then
A(3,:) is the 3rd row of A
A(:,3) is the 3rd column of A
If A is a multi-dimensional array, then a bit more explanation is required, which can be found here:
https://www.mathworks.com/help/matlab/ref/colon.html?searchHighlight=colon&s_tid=doc_srchtitle
Plus de réponses (1)
Philip Abel
le 23 Oct 2022
Given a matrix "a" with elements
a = [1 2 3; 4 5 6]
To find a(x,y), it is important to note that:
- x stands for row
- y stands for column.
- : stands for all
- thus, a(x,y) is the element where x and y intersects.
- a(1,3) : is the element on the intersection of row 1 and column 3.
- a(:,3) : are the elements on the intersection of all rows and column 3.
- a(1,:) : are the elements on the intersection of row 1 and all columns.
a = [1 2 3; 4 5 6];
p = a(1,3)
q = a(:,3)
r = a(1,:)
0 commentaires
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!