連続する要素の抽出方法

13 visualizzazioni (ultimi 30 giorni)
KH
KH il 5 Ago 2020
Commentato: Akira Agata il 6 Ago 2020
列データ内の2個以上5個未満の値(のグループ)を置換or消去するにはどうすればいいでしょうか?
例えば、下のようなデータがあった場合、
x = [0,0,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]
%出力したい結果
>> x = [0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]
出力したい結果のように最初の 1,1 のグループのみ置換する良い方法はないでしょうか?
よろしくお願いします。
  1 Commento
Akira Agata
Akira Agata il 6 Ago 2020
連続する個数が2個以上5個未満の "1" を "0" に置換したいということでしょうか?(左端の "0" は2個連続していますが、これはそのまま残して良いでしょうか?)

Accedi per commentare.

Risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!