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일

0 개 추천

vec = [0 1 0 0 0 1 0 0 1 0 0 0 0 0 ]' ;
idx = find(vec==1) ;
iwant = diff(idx)-1

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2017년 1월 23일

답변:

2017년 1월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by