To delete repeated data in Matlab, you can use the unique
function. Here is an example:
Suppose you have a vector x
:
main.m33 chars2 lines
To get a new vector with repeated elements removed, simply call the unique
function:
main.m15 chars2 lines
The resulting vector y
is:
main.m24 chars2 lines
Note that the order of elements in y
may be different from that in x
.
gistlibby LogSnag