Search for non-zero members

 

mfind(A,n), search for positions of the first n non-zero members in matrix A by column.


A

1

[[1,0],[0,71.2833],[0,0],[35,53.1],[35,8.05]]

2

=mfind(A1,4)

3

=mfind(A1)

4

=mfind(A1,100)

A1 Input a matrix with zero elements

A2 Search for the first 4 non-zero members by column. The first 4 non-zero elements in A1 are 1,35,35,71.2833 corresponding to the position 1,4,5,7, so return the position sequence [1,4,5,7]

..

A3 Finds the 1st non-zero element position when n is absent. Return 1.

A4 If the total number of non-zero members is fewer than n, returns positions of all non-zero, non-null members.

..