[SciPy-user] nonzero and the matlab equivalent of find
per freem
perfreem@gmail....
Sun Jul 12 16:51:04 CDT 2009
hi all,
i am trying to find an equivalent of matlab's find in scipy. the
documentation says to use nonzero but i am not sure how to interpret the
results.
suppose i have an array:
a = [[0, 1], [1, 1], [1, 0]]
and i want to return the indices (0, 1, or 2 in this case) of the elements
that are [1, 1]. the natural notation seems to be:
nonzero(a == array([1, 1]))
but this returns: (array([0, 1, 1, 2]), array([1, 0, 1, 0])) -- not sure
what this output means.
can someone please explain how to find the elements that are [1,1], like in
matlab's "find"? thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20090712/a63da737/attachment.html
More information about the SciPy-user
mailing list