How to create a smaller matrix from a larger one?

5 vues (au cours des 30 derniers jours)
Rand Renwar
Rand Renwar le 30 Sep 2016
Modifié(e) : KSSV le 30 Sep 2016
So if I were to have a matrix M
M = [ 0 4 5 6
3 9 1 4];
And I wanted to create a smaller Matrix Z from M
Z = [ 5
1]
What would be the easiest/fastest way to do this?

Réponse acceptée

KSSV
KSSV le 30 Sep 2016
Modifié(e) : KSSV le 30 Sep 2016
Z = M(:,3) ; % Z happens to be a third column in M
Read about matrix indexing.
https://in.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing 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!

Translated by