I have
R = input('Please enter a number of rows for the matrix')C = input('Please enter a number of columns for the matrix')M = randi(2, R, C)for M2 = 1:numel(M) if M(M2) > 1 M(M2) = -1 endendM3 = Mfor MN = 1:numel(M3)
I need to: Part c: You will need to use a loop to check the neighbors of each element and then count how many agree with the current element you are on. You will need to check the elements to the left, right, above and below. You will probably need to create another matrix to keep track of the similar spin count.
How do i do this?
Best Answer