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://jp.mathworks.com/matlabcentral/fileexchange/24641-vectorized-find-with-first-option), MATLAB Central File Exchange. に取得済み.

MATLAB リリースの互換性
作成: R2009a
すべてのリリースと互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersSparse Matrices についてさらに検索
タグ タグを追加
謝辞

ヒントを与えたファイル: csearch

バージョン 公開済み リリース ノート
1.1.0.0

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

1.0.0.0