Hi Murat,
As I can understand from Line 22-23, Mposition/Mvelocity are 2-D matrix and returned VpositionA/ VvelocityA are 1-D vectors. Since in Line 26-27 the same Mposition/Mvelocity is used in array indexing but here VindexB is an 1-D array rather than scalar value i, that is why the returned MpositionB/MvelocityB will be again a 2-D array rather than 1-D vector. I assume the size of VindexB is significantly greater than 1, that is why there is scaling of 10-15 times in time taken.
Here since the size of returned variable is different (1-D vs 2-D) in both set of lines, therefore we cannot compare the time taken. In my opinion if you are not thinking of using parfor then array indexing will work fine.