In reply to Richard Montes.

Great! You could also eliminate the pre-allocation and the DO loop by using
M = choose(sim_mean > 100, 1, 2);
For an explanation, see my blog post on using the CHOOSE function.