Arduino -> Processing conversion: creating mux channels
When making an array I processing you must use the code

int[] xyz = \*declare variable or new*\ {
    this is some code
}


You used

int xyz[num][num]


You must declare the values of the array only after declaring it.
Also, did you try declaring digitalWrite as a new variable?