Index them! Either as a structure, or an array with a 4th dimension. I personally favour structures, since 4D data makes my head hurt ;) dot indexing is great for looping results.
Also note that you will only get 2 runs of your loop, as after the 2nd run n will equal 3, and your loop terminates before running a 3rd time since the condition is less than 3. Either make the condition less than or equal to 3, or you can use a for loop instead, as your while loop is essentially a for loop where you do the counting yourself - something you dont need to do in this case.
pixelArray(y2(n):end,:,:) = ;