How to count how many times a number repeat in a sequence

조회 수: 3 (최근 30일)
Fabio Vicentin
Fabio Vicentin 2022년 6월 9일
댓글: Fabio Vicentin 2022년 6월 15일
I have an matrix:
Result = [ 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 1 1 0 1 ....] so on until row 24.926
And i want to count in this way (how many times the zeros or one repeat and change in value):
One = [1 1 1 0 1 1 0 1 1 1 0 1 1 1 0 0 1 1 1 ...]
Two = [0 0 0 1 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 ...]
Three = [0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 ...]
Four = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...]
Five = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...]
Any good help is appreciated.

채택된 답변

dpb
dpb 2022년 6월 9일
There are other similar submissions with slightly different functionalities; search at your heart's content.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by