Let's make a sample matrix M with some 999 values present in columns 1 and 4. I'll also make a backup copy of it so we can modify the original several times, restoring from the backup each time.
Now let's approach this in three different ways. The first creates variables for each column to check (though this could be combined into one command, replacing column1Has999 and column4Has999 with the right-hand side expression in the line of code that creates the variable eitherColumnHas999.
column1Has999 = M(:, 1) == 999
column4Has999 = M(:, 4) == 999
eitherColumnHas999 = column1Has999 | column4Has999
M(eitherColumnHas999, :) = 
But if you want to check a large collection of columns that's going to be a lot of repetitive code. Instead you could use any.
checkedColumnsHave999 = any(M(:, columnsToCheck) == 999, 2)
M(checkedColumnsHave999, :) = 
A third option would be to standardize the representation of missing data in M using standardizeMissing and then to use rmmissing.
M = standardizeMissing(M, 999)