How to delete repeating value in a row ?

code: from a = [1 2 2 4 4 2 2 1 1 4 4 ]
become b = [1 2 4 2 1 4]

 Accepted Answer

a = [1 2 2 4 4 2 2 1 1 4 4 ]
a = 1×11
1 2 2 4 4 2 2 1 1 4 4
b = a([true diff(a)~=0])
b = 1×6
1 2 4 2 1 4

1 Comment

Thank you very much mr. Bruno Luong for your fast response.
It is function very good.

Sign in to comment.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!