First, a big warning, don't use length (for vectors numel is better) and certainly don't use length on a matrix. On a matrix use size with an explicit dimension. I also don't understand why you hardcode one dimension and retrieve the other, why not retrieve both:
for row = 1:size(T, 1)
for col = 1:size(T, 2)
is a lot safer than what you wrote. In any case, your loop code is very flawed. Never delete elements of an array when you iterate over it since your index gets out of sync with the actual rows. E.g, at i = 8 you delete row 8. row 9 is now row 8, row 10 is now row 9, etc. You then increase i, which becomes 9, and test flag(9, j) but row 9 of T is what used to be row 10. Out of sync.
Anyway, to answer your question, it's simply:
T(any(flag > 2, 2), :) = ;