How to delete repeating value in a row ?

1 view (last 30 days)
code: from a = [1 2 2 4 4 2 2 1 1 4 4 ]
become b = [1 2 4 2 1 4]

Accepted Answer

Bruno Luong
Bruno Luong on 28 Aug 2022
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
omran alshalabi
omran alshalabi on 28 Aug 2022
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 Vector Fields 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!