Howdy, I am running the following code and wonder if can vectorize to speed up:

`pop_matrix = [10 0 0 0 0 0];rand_num =rand;divid = [0.05 0.05 0.1 0.2 0.1 0.1];for i = 1:length(pop_matrix) if rand_num < sum(divid(1:i)) pop_matrix(i) = pop_matrix(i)+1; break endend`

Thanks a lot!

## Best Answer