Made work again for parallel computation

changed the way the loop worked so that parallel computation possible
To use, start just uncomment the two 'matlabpool' lines before and after
the simulation loop, and second uncomment the 'parfor' loop and comment
out the 'for' loop.