Working with the uq_create_morris_trajectory function and it tries to find the derivative index (DerIdx) from the permutation matrix (P). However, I wonder why the temporary order is sorted (sort(TempDerIdx)). To me, not sorting will yield the correct result?
Checking again, as expected, I was making a mistake and the sorting is necessary because the permutation matrix determines the derivative index position and the sorting determines the derivative index of the intended variable.
The coding of this part is very concise and smart.