Hi Daniel,
You asked, How would I go ordering the original [nx2] matrix based off knowing the indices/coordinates adjacent to each point?
To order the original [nx2] matrix using the adjacent indices or coordinates, you can utilize the sortrows function in MATLAB. This function sorts the rows of a matrix based on specified columns. By specifying the columns corresponding to the adjacent indices, you can achieve the desired sorting. For more information about this function, please refer to
https://www.mathworks.com/help/matlab/ref/double.sortrows.html
I will also provide an example to help you how to use this function.
>> % Original matrix
A = [4 5; 2 3; 1 2; 3 4];
% Sort based on adjacent indices in the first column
sortedA = sortrows(A, 1);
disp(sortedA);
So, in the above code,sortrows(A, 1) sorts matrix A based on the values in the first column. You can adjust the column index according to the adjacent indices you want to use for sorting.
