How to crop some matrix row

조회 수: 1 (최근 30일)
Mahi Nazir
Mahi Nazir 2014년 9월 4일
댓글: Mahi Nazir 2014년 9월 4일
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?

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by