連続する要素の抽出方法

12 views (last 30 days)
KH
KH on 5 Aug 2020
Commented: Akira Agata on 6 Aug 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 Comment
Akira Agata
Akira Agata on 6 Aug 2020
連続する個数が2個以上5個未満の "1" を "0" に置換したいということでしょうか?(左端の "0" は2個連続していますが、これはそのまま残して良いでしょうか?)

Sign in to comment.

Answers (0)

Categories

Find more on 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!