Vectorized FIND with 'FIRST' option (Scripts) Publisher's description
from Bruno Luong
Up to now, to find the first non-zero element of a matrix along a column (for example)
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
... = find(A(:,j), 1, 'first');
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)
System Requirements:MATLAB 7.8 (R2009a)
Program Release Status: New Release
Program Install Support: Install and Uninstall