python matrix to list of non zero elements code example
Example: extract nonzero array elements python
numpy.nonzero(array)
#Return the indices of all the nonzero elements in the array
numpy.nonzero(array)
#Return the indices of all the nonzero elements in the array