extracting the nth multiple rows of a large matrix to create a submatrix

4 vues (au cours des 30 derniers jours)
MIRABEL ACQUAH
MIRABEL ACQUAH le 5 Déc 2018
Commenté : Stephen23 le 20 Avr 2022
Hi. Please i have a large matrix a=(1290 x 2) and i want to extract rows in multiple of 5 to create a new matrix. For example, a new matrix x, should be made of, the 5th row,10th row,15th row and so on, of matrix a. Please help me, I am new to MATLAB. Thanks

Réponses (2)

madhan ravi
madhan ravi le 5 Déc 2018
Modifié(e) : madhan ravi le 5 Déc 2018
Simpler and easier:
x = a(5:5:end,:) % edited after all the comments
  4 commentaires
Image Analyst
Image Analyst le 5 Déc 2018
And (should be obvious, but evidently she's a beginner), to create the x she asked for:
x = a(5:5:end,:)
madhan ravi
madhan ravi le 5 Déc 2018
Thank you sir Image Analyst!

Connectez-vous pour commenter.


Kevin Chng
Kevin Chng le 5 Déc 2018
try, let say a is your matrix(1290x2)
a(1:5:1290,:)
  2 commentaires
Stephen23
Stephen23 le 20 Avr 2022
This answer does not select the requested rows:
1:5:1290
ans = 1×258
1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 101 106 111 116 121 126 131 136 141 146

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by