HOW TO MOVE THE DIAGONAL ELEMENTS IN MATRIX (ONE PIXELS) FOR IMAGE PROCESSING

how to move the array
1 4 6
8 2 3
7 9 5
all elements are move diagonally one pixel for m*n matix

3 件のコメント

Walter Roberson
Walter Roberson 2012 年 9 月 13 日
Please show an example input and example output.
ajith
ajith 2012 年 9 月 13 日
編集済み: ajith 2012 年 9 月 13 日
example output
2 3 6
9 5 4
7 8 1

サインインしてコメントする。

 採用された回答

Andrei Bobrov
Andrei Bobrov 2012 年 9 月 13 日
I = [
1 4 6
8 2 3
7 9 5]; % initial array
idx = reshape(1:numel(I),size(I));
for jj = -size(I,1) + 2 : size(I,2) - 2
a = diag(idx,jj);
I(a) = I(circshift(a,1));
end

1 件のコメント

ajith
ajith 2012 年 9 月 13 日
編集済み: ajith 2012 年 9 月 13 日
Thanks a lot sir but i need that code for M*N matrix

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSparse Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by