I have a matrix in MATLAB like
t2 =
0.4366 0.4298 0.5907
0.9401 0.5358 0.6136
0.2305 0.5212 0.9759
0.9545 0.5572 0.9042
I want to get the largest element on each row and set them to be one, the rest to be zero. So
t2 =
0 0 1
1 0 0
0 0 1
1 0 0
How can I do that with the fewest commands?