• esProc
Tutorial
Function Reference
User Reference
External Library Guide
Data File Tool Manual
DQL Tutorial
Cluster Server Manager Manual
SPL Command Executor Manual
• YModel
User Reference
JSON-style Parameter Guide
• ReportLite
User Reference
• Official Website

# mfind()

Description:

Search for positions of non-zero members in a vector or matrix.

Syntax:

mfind(A, n)

Note:

The external library function searches for positions of the first n non-zero members in vector or matrix A. It gets the position of the first non-zero member when parameter n is absent. If the total number of non-zero members is fewer than n, it returns positions of all non-zero, non-null members.

Search column by column when A is a matrix and return ordinal numbers of positions of non-zero members in the matrix.

Parameter:

 A n A vector or a matrix A positive integer

Return value:

A sequence

Example:

A

1

[0,,5,2,0,2,1,0]

2

=mfind(A1) Return position of the first non-zero member as parameter n is absent

3

=mfind(A1,3)

Retrun positions of the first non-zero members 4

=mfind(A1,10) Return positions of all non-zero members since the number of them in matrix A1 is fewer than n (here is 10)

5

[[1,0,2],[0,0,2],[0,4,7]]

6

=mfind(A5,3) As parameter A is a matrix, search for the first three non-zero members by column and the result are “1”,“4”,”2”, whose ordinal numbers of positions are 1,6,7