how to get odd rows and columns,even rows and columns
조회 수: 24 (최근 30일)
이전 댓글 표시
A1 is the lena image
A is to the first row
similarly how to get the even rows ,even columns,odd rows,odd columns
A1 = imread('lena1.jpg');
A=A1(:,1);
댓글 수: 3
채택된 답변
Birdman
2018년 3월 13일
Consider you have number of rows and columns which is an even number,
Odd rows:
A1(1:2:end-1,:)
Even rows:
A1(2:2:end,:)
Odd columns:
A1(:,1:2:end-1)
Even columns:
A1(:,2:2:end)
댓글 수: 3
Jos (10584)
2018년 3월 14일
By substracting one, you discard the last odd row (column) when the number of rows (columns) of the array is odd. When this number is even, it does not matter, so just to be flexible, do not subtract one :)
Birdman
2018년 3월 14일
Yes you are right Jos, therefore at the beginning of the question, I stated that:
Consider you have number of rows and columns which is an even number
:)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!