How can I create this simple matrix?

DNdog =
108
108
107
107
23
23
y = 108 %How do I get the above matrix to this state?
107
23

 Accepted Answer

Using
unique

4 Comments

y = 23 %This is happening.
107
108
y = 108 %I want it to be like this.
107
23
Use 'stable' as the set order specifier:
y = unique(DNdog, 'stable')
My pleasure!

Sign in to comment.

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!