フィルターのクリア

how to calculate neighbouring cells on a matrix?

3 ビュー (過去 30 日間)
Ido Koltin
Ido Koltin 2015 年 12 月 9 日
コメント済み: Mohammad Abouali 2015 年 12 月 9 日
Hi, i need to calculate a Matrix where every centre cell need to get the sum value of its neighbouring cells. the "catch" is that also the last columns (lets call it east and west), needs to also get each others value (such as on earth for instance) as neighbours. any ideas? thanks!

採用された回答

Mohammad Abouali
Mohammad Abouali 2015 年 12 月 9 日
use a combination of padarray() and conv2(). Something like this:
A=reshape(1:100,10,10)
A_Padded=padarray(A,[1 1],'circular')
kernel=ones(3,3);
A_SumNeighbor = conv2(A_Padded,kernel,'valid')
  2 件のコメント
Ido Koltin
Ido Koltin 2015 年 12 月 9 日
Thank you
Mohammad Abouali
Mohammad Abouali 2015 年 12 月 9 日
you are welcome

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeometric Geodesy についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by