CONTIGUOUS -- Start and stop indices for contiguous runs

버전 1.0.0.0 (943 Bytes) 작성자: David Fass
RUNS = CONTIGUOUS(A,NUM) returns the start and stop indices for contiguous runs of the elements NUM
다운로드 수: 1.6K
업데이트 날짜: 2004/8/12

라이선스 없음

RUNS = CONTIGUOUS(A,NUM) returns the start and stop indices for contiguous runs of the elements NUM within vector A. A and NUM can be vectors of integers or characters. Output RUNS is a 2-column cell array where the ith row of the first column contains the ith value from vector NUM and the ith row of the second column contains a matrix of start and stop indices for runs of the ith value from vector NUM. These matrices have the following form:

[startRun1 stopRun1]
[startRun2 stopRun2]
[ ... ... ]
[startRunN stopRunN]

Example: Find the runs of '0' and '2' in vector A, where A = [0 0 0 1 1 2 2 2 0 2 2 1 0 0];

runs = contiguous(A,[0 2])
runs =
[0] [3x2 double]
[2] [2x2 double]

The start/stop indices for the runs of '0' are given by runs{1,2}:

1 3
9 9
13 14

RUNS = CONTIGUOUS(A) with only one input returns the start and stop indices for runs of all unique elements contained in A.

CONTIGUOUS is intended for use with vectors of integers or characters, and is probably not appropriate for floating point values. You decide.

인용 양식

David Fass (2024). CONTIGUOUS -- Start and stop indices for contiguous runs (https://www.mathworks.com/matlabcentral/fileexchange/5658-contiguous-start-and-stop-indices-for-contiguous-runs), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R13
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

added keywords