How do I reshape this to make the 3rd column into a 2x2 matrix, so that the whole thing can be graphed as a surface?
You don't, it's completely unnecessary
surf(yourmatrix(:, 1), yourmatrix(:, 2), yourmatrix(:, 3));
If you wanted to do the reshape (which again is completely unnecessary), and assuming that the X and Y coordinates that are supposed to be identical are actually identical down to the last binary digit, then:
[~, ~, col] = unique(yourmatrix(:, 1));
[~, ~, row] = unique(yourmatrix(:, 2));
X(row, col) = yourmatrix(:, 1);
Y(row, col) = yourmatrix(:, 2);
Z(row, col) = yourmatrix(:, 3);
Best Answer