Sorting an array and retrieving the minimum and maximum values with the index may seem simpler but this helped me in many ways especially when working with arrays. So this is just a refresh on how to sort a 1 and 2d arrays.

Single dimensional array sorting

To sort the array and display the position (index):

A = [5 8 9 10 100 7 50 8 88 6;];

Before sorting:

A =589101007508886

[sorted_array,pos]= sort(A)

After sorting: Here the sorted array and the array position of each value will be displayed.