how to get odd rows and columns,even rows and columns
27 ビュー (過去 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!