how to calculate neighbouring cells on a matrix?
    5 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Ido Koltin
 el 9 de Dic. de 2015
  
    
    
    
    
    Comentada: Mohammad Abouali
      
 el 9 de Dic. de 2015
            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!
0 comentarios
Respuesta aceptada
  Mohammad Abouali
      
 el 9 de Dic. de 2015
        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 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Earth and Planetary Science en Help Center y File Exchange.
			
	Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

