sorting non-exact x/y data into rows and columns, typewriter style
say I have the following two arrays:
x=[1.01 2.01 1.02 2.02];
y=[1.01 1.02 2.01 2.02];
sorting these rows using
xy = table(x’,y’)
[~, id] = sortrows(xy)
gives the answer of
id = [1;3;2;4];
I’m hoping to obtain the ‘typewriter’ answer of
id = [3, 4; 1, 2]
or something similar that tells me the third element of the table is the upper left, etc. The eventual goal is to combine elevation .tiff in the correct order to form a coherent dataset from northwest to southeast.
I feel like this should be a simple solution, but I’m delving into loops and logic and feel like I’m missing something easy.
Thanks in advance.say I have the following two arrays:
x=[1.01 2.01 1.02 2.02];
y=[1.01 1.02 2.01 2.02];
sorting these rows using
xy = table(x’,y’)
[~, id] = sortrows(xy)
gives the answer of
id = [1;3;2;4];
I’m hoping to obtain the ‘typewriter’ answer of
id = [3, 4; 1, 2]
or something similar that tells me the third element of the table is the upper left, etc. The eventual goal is to combine elevation .tiff in the correct order to form a coherent dataset from northwest to southeast.
I feel like this should be a simple solution, but I’m delving into loops and logic and feel like I’m missing something easy.
Thanks in advance. say I have the following two arrays:
x=[1.01 2.01 1.02 2.02];
y=[1.01 1.02 2.01 2.02];
sorting these rows using
xy = table(x’,y’)
[~, id] = sortrows(xy)
gives the answer of
id = [1;3;2;4];
I’m hoping to obtain the ‘typewriter’ answer of
id = [3, 4; 1, 2]
or something similar that tells me the third element of the table is the upper left, etc. The eventual goal is to combine elevation .tiff in the correct order to form a coherent dataset from northwest to southeast.
I feel like this should be a simple solution, but I’m delving into loops and logic and feel like I’m missing something easy.
Thanks in advance. sorting, array MATLAB Answers — New Questions