Vectorized FIND with 'FIRST' option

버전 1.1.0.0 (5.13 KB) 작성자: Bruno Luong
Find the first non-zero element(s) along row/column - or any other dimension
다운로드 수: 3K
업데이트 날짜: 2010/5/19

라이선스 보기

Up to now, to find the first non-zero element of a matrix along a column (for example) user might:

1. Use for-loop with FIND command
for j=1:size(A,2)
... = find(A(:,j), 1, 'first');
end

2. Use other vectorized methods, often time not very straight-forwards (MAX, LOGICAL, SPARSE, etc...). This method creates temporary arrays and scan such the arrays few times while doing some calculation.

3. Write the basic FOR-LOOP algorithm to accomplish the task.

The FINDFIRST command does just the same, but implemented using MEX engine which should be faster than any of the above. It can handle 'FIRST', 'LAST' option, and return more than one FIND count.

NOTE: not yet tested on Linux (gcc)

인용 양식

Bruno Luong (2026). Vectorized FIND with 'FIRST' option (https://kr.mathworks.com/matlabcentral/fileexchange/24641-vectorized-find-with-first-option), MATLAB Central File Exchange. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2009a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Sparse Matrices에 대해 자세히 알아보기
태그 태그 추가
도움

도움 준 파일: csearch

Community Treasure Hunt

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

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

Fix a bug when 'last' in invoked on 64-bit platform

1.0.0.0