i have a question about matrix assignment.
say i have three matrices A, B and C, and i want to assign the elements of matrix C to the elements of A and B according to the rule
C[i,j] = A[i,j] if abs(C[i,j] - A[i,j]) < abs(C[i,j] - B[i,j])
C[i,j] = B[i,j] if abs(C[i,j] - A[i,j]) > abs(C[i,j] - B[i,j])
C[i,j] = 0 if abs(C[i,j] - A[i,j]) == abs(C[i,j] - B[i,j])
how can i write it without for loops?
thanks very much for your help.