How do I find the number of elements of a matrix with distance n from a specific element?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
How do I find number of elements surrounding a specific element with a distance of n from a specific element.
For example A = [1 2 3 9;4 5 6 7; 8 9 2 3]
for the first element 1 i.e A(1,1) the number of elements with a distance of 1 is 3 (they are 2,4 and 5) and for 6 i.e A(2,3) the number is 8 ( they are 2,5,9,2,3,7,9 and 3).
for the first element 1 i.e A(1,1) the number of surrounding elements with a distance of 2 is 5 (they are 8,9,2,6 and 3) and for 6 i.e A(2,3) the number is 3 (they are 1,4 and 8).
and so on..
Any help is appreciated. Thanks.
2 Commenti
Guillaume
il 19 Mar 2019
I don't see the significance of the numbers in the matrix.
This seems like a geometry question rather than a matlab one: how to calculate the perimeter of a clipped square.
Risposte (0)
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!