while loop with multiple conditions matlab