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일

0 개 추천

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개)

카테고리

질문:

2014년 9월 4일

댓글:

2014년 9월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by