creates a column vector index from subsequent columns of array valArray on each iteration. For example, on the first iteration, index = valArray(: ...
stackoverflow.com