How to count zeros between not zero

11 ビュー (過去 30 日間)
TaeWoo Kim
TaeWoo Kim 2017 年 1 月 23 日
回答済み: KSSV 2017 年 1 月 23 日
I want to count the number of zeros between 1 in each columns.
14X3 matrix
So, results should be 3,2 in first column, 4 in second column and 2,3 in third column Please, help me.

採用された回答

KSSV
KSSV 2017 年 1 月 23 日
vec = [0 1 0 0 0 1 0 0 1 0 0 0 0 0 ]' ;
idx = find(vec==1) ;
iwant = diff(idx)-1

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by