In this matlab post, one can find solution of "Loop erasing random walk" vector problem. This problem consists in "erasing loops" which means: removing integers between any integer repetition.
Example:
v=[3 1 4 6 7 9 1 22 87 33 35 36 37 35 34] becomes [3 1 22 87 33 35 34].
How can one solve the same problem with 2 columns matrix (planar case)?
v=[1 1; 2 1; 2 2; 2 3; 3 3; 3 2; 2 2; 2 3; 2 4] should be [1 1; 2 1; 2 2; 2 3; 2 4]