Matlab Repeat Loop Until Condition Is Met