MATLAB: How to change table dimensions by ordering by column values

arrayrestructuretablevariable

Here is my table so far:
1 -1 0.532
1 -2 0.765
1 0 0.726
1 1 0.526
1 2 0.915
2 -1 0.693
2 -2 0.485
2 0 0.624
2 1 0.627
2 2 1.197
3 -1 0.647
3 -2 0.850
3 0 0.723
3 1 0.516
3 2 0.706
How can I change it into a format that looks like this:
-1 -2 0 1 2
1
2
3

Best Answer

Assume you put in those 15 numbers into a column vector:
a=(1:15)';
b=reshape(a,5,3);
t=array2table(b');
t.Properties.VariableNames={'N1','N2','Zero','One','Two'};
t.Properties.RowNames={'One','Two','Three'}
t =
3×5 table
N1 N2 Zero One Two
__ __ ____ ___ ___
One 1 2 3 4 5
Two 6 7 8 9 10
Three 11 12 13 14 15