Effacer les filtres
Effacer les filtres

How to crop some matrix row

2 vues (au cours des 30 derniers jours)
Mahi Nazir
Mahi Nazir le 4 Sep 2014
Commenté : Mahi Nazir le 4 Sep 2014
How do I crop a 105x41 matrix to get a 41x41 matrix. I want to crop the top and bottom rows to get the central 41x41 matrix. Something like opposite of padarray?

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 4 Sep 2014
A = randi([0 255],105,41,'uint8'); % your matrix
i1 = ceil(size(A,1)/2);
out = A(i1 - 20 : i1 + 20,:);
  1 commentaire
Mahi Nazir
Mahi Nazir le 4 Sep 2014
Thank you so much! Does exactly what I want

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating 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!

Translated by