Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

How to remove repeated values mantaining the first one from an array ?

1 Ansicht (letzte 30 Tage)
Andre
Andre am 8 Dez. 2014
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
I have something like:
10000111111111011011100000111011000111111011000000010101011111111....
how to:
00000100000000010010000000100010000100000010000000000000010000000....
The second repetition makes the beggining of a series.

Antworten (2)

Sean de Wolski
Sean de Wolski am 8 Dez. 2014
abs(diff('0000111001111101101'))
  1 Kommentar
Guillaume
Guillaume am 8 Dez. 2014
Hum, it looks like the OP only wants the transitions from 0 to 1 (which would be diff(x) > 0) but only when there's more than one consecutive 1 (which is not as simple unfortunately).

Guillaume
Guillaume am 8 Dez. 2014
s = '10000111111111011011100000111011000111111011000000010101011111111'
o = char('0' + ([0 diff(s) > 0] & [~diff(s) 0]))

Diese Frage ist geschlossen.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by