Neighbors recognition
BLOG UNDER CONSTRUCTION A quick guide issue: a cell which is surrounded by other cell and the neighboorhood is a criterion to a state transition. In this first moment let assume that we are working on a double matrix n x n called L, where n = 10. So, we wonder the empty and occupied neighbors of a target cell which are placed in a given position. Thus the most important as aspects of this problem is the cell position into the matrix, we can figure it out by searching row and column or a linear index. I will work out here a minimal example with linear index because of the implementation which shares similarities in the end. So let assign our cell with value 10, therefore. idxL = find(L==10) Now we're going to sum our variable idxL which is assigned with the linear index with an auxiliar variable called auxV auxV = [-n-1 -n -n+1 -1 1 n+1 n n-1]