This sounds similiar to a question that you already posed. Okay, so maybe you want to restart from scratch. My take:
Code:
Read from file into a 2D array of integers. Let's name this array input.
Create number_of_rows arrays of 3 arrays of integers for the row_counts, zero initialising the elements.
Create number_of_columns arrays of 3 arrays of integers for the column_counts, zero initialising the elements.
For each row
For each column in the current row
Let x = 0, 1, or 2 if input[row][column] is 1, 0, -1, respectively.
Increment row_counts[row][x]
Increment column_counts[column][x]