MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > finding neighboring cells in a large matrix 

Subject: finding neighboring cells in a large matrix From: Naresh Pai Date: 3 Feb, 2011 02:59:05 Message: 1 of 6 
I have a large binary matrix (4630 x 7040) consisting of 1's and 0's. I am wanting to find out the indices of neigboring cells of all 1's. I am using the FEX submission ixneighbors (File ID: #16991) to do this which requires the binary matrix and indices of 1's. as inputs However, when I pass the matrix the computer runs out of memory. Here is a simulated example: 
Subject: finding neighboring cells in a large matrix From: ImageAnalyst Date: 3 Feb, 2011 03:43:52 Message: 2 of 6 
You could use bwlabel or bwconncomp to find touching array elements. 
Subject: finding neighboring cells in a large matrix From: Naresh Pai Date: 3 Feb, 2011 07:08:03 Message: 3 of 6 
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <78e4a31dc4f34d6d89da12f9d0422a04@s11g2000yqh.googlegroups.com>... 
Subject: finding neighboring cells in a large matrix From: ImageAnalyst Date: 3 Feb, 2011 11:14:10 Message: 4 of 6 
But M is not a binary matrix  it's an integer matrix. You'd have to 
Subject: finding neighboring cells in a large matrix From: Sean de Date: 3 Feb, 2011 13:40:04 Message: 5 of 6 
"Naresh Pai" <npai@uark.edu> wrote in message <iid5lp$k8n$1@fred.mathworks.com>... 
Subject: finding neighboring cells in a large matrix From: Naresh Pai Date: 3 Feb, 2011 16:27:03 Message: 6 of 6 
"Sean de " <sean.dewolski@nospamplease.umit.maine.edu> wrote in message <iieb7k$s4c$1@fred.mathworks.com>... 
No tags are associated with this thread.
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.