I have a matrix with entries as "1" at random places and i need to find (a) find its non-zero neighbours (b) find the euclidean distance between its non-zero neighbours and the pixel itself

# MATLAB: How to find the distance between two non-zero (the element is a one) elements in a matrix

euclidean distanceneighbours

###### Related Question

- How to find euclidean distance between one vector and many other vectors
- Rearranging and printing matrices
- How to find the lowest pixel in a 3d matrix
- How to calculate the shortest distance between points and a line
- How to reshape rows into columns
- Finding Distance Between Each Point (not the diagonal distance)

## Best Answer