Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
first time user syntax help
Hey, I have a 2048x2048 matrix with values of either 0 or 1 which is called "white". I need to find the total number of 3x3 blocks in the matrix where each data point has a value of 1, ie,
1 1 1
1 1 1
1 1 1
Im a first time user and I think that my problem is syntax. My code is as follows,
for i=2:2047 j=2:2047
if white(i-1,j-1)==1 & white(i-1,j)==1 & white(i-1,j+1)==1 & white(i,j-1)==1 & white(i,j)==1 & white(i,j+1)==1 & white(i+1,j-1)==1 & white(i+1,j)==1 & white(i+1,j+1)==1
Ive been at it for a few hours and any help would be really appreciated. Ill be spending the rest of the afternoon trying to solve this problem....
Thanks for your help!