Circular indexing of a 2D array
古いコメントを表示
My Tp matrix is as follows,
1 2 3 7
Tp= 4 5 6 5
7 8 9 8
The code is,
for i=1:3
for j=1:4
if i==1 && j==1
T(i,j)=Tp(i,j-1)
end
if i==2 && j==4
T(i,j)=Tp(i,j+1)
end
end
end
I want the answer of the first IF condition to be T(i,j)=7, which is the element on the other side of the Tp matrix.
Second IF condition answer to be T(i,j)=4, which is the element on the other side of the Tp matrix.
How will I be able to do this?
Thanks in advance.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!