matlab - How to extract elements in an array that have multiple entries? -


i have large vector contains monotonically increasing data or duplicate, looking this:

data = [0 1.1 2.2 3.3 4.4 4.4 4.4 4.4 5.5 6.6 6.6 6.6 7.7]; 

in data set, i'm interested in duplicate entries (in case, 4.4 , 6.6). have sorta clunky solution extract these values, feel matlab should have one-liner solution extract result like

result = [4.4 6.6]; 

the combination of unique , diff enough, find not necessary.

out = unique(data(~diff(data))) 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -