MATLAB: How to find rearrange these values in a new row and column

MATLABmatrixrearrangeuniversity

For example: I have the following array of data.
column 1 column 2
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
I would like to make a new array of data sets with
column 1 column 2
2 3
4 5
5 6
8 9
What would be the best command to rearrange the matrix?

Best Answer

One approach:
A = [1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9];
L = ismember(A(:,1), [2 4 5 8]);
B = A(L,:)
produces:
B =
2 3
4 5
5 6
8 9