MATLAB: How to transform a 2×5184 data set

data transformation

Hi,
I am trying to transform my 2×5184 data set into a 72×72 data set.
I would like the data to read as
2.0000 28.2000 28.2000 25.8000 24.7000 23.5000 24.7000 28.2000 ….
2.0694 28.2000 28.2000 22.3000 21.1000 20.0000 21.1000 20.0000 ….
If you see below in the data set I have now the first 72 iterations of column 1 are the same value and then the next 72 are the same. I would like to put all the values in the second column that correspond to the same value in column 1 into a single row. Is there an easy way to do this?
the data set currently looks like this
2.0000 28.2000
2.0000 28.2000
2.0000 25.8000
2.0000 24.7000
2.0000 23.5000
2.0000 24.7000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 22.3000
2.0694 21.1000
2.0694 20.0000
2.0694 21.1000
2.0694 20.0000
2.0694 22.3000
2.0694 25.8000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000
2.0694 28.2000

Best Answer

Try this:
D = [2.0000 28.2000
2.0000 28.2000
2.0000 25.8000
2.0000 24.7000
2.0000 23.5000
2.0000 24.7000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
2.0000 28.2000
. . . ];
[Du,~,idx] = unique(D(:,1));
rv = accumarray(idx, D(:,2), [], @(x){x});
Out = [Du, reshape(cell2mat(rv'), [], numel(Du))']
Out =
Columns 1 through 11
2.0000 28.2000 28.2000 25.8000 24.7000 23.5000 24.7000 28.2000 28.2000 28.2000 28.2000
2.0694 28.2000 28.2000 22.3000 21.1000 20.0000 21.1000 20.0000 22.3000 25.8000 28.2000
...and so for the rest.