Re: Given a matrix, find position of first non-zero element in each
- To: mathgroup at smc.vnet.net
- Subject: [mg99570] Re: Given a matrix, find position of first non-zero element in each
- From: Peter Pein <petsie at dordos.net>
- Date: Fri, 8 May 2009 00:15:47 -0400 (EDT)
- References: <gtrl9k$242$1@smc.vnet.net> <gtudbp$inj$1@smc.vnet.net>
Jens-Peer Kuska schrieb:
> Hi,
>
> Map[Min, Transpose /@
> Split[Position[A, a_ /; a =!= 0, {2}, Heads -> False ],
> First[#1] === First[#2] &], {2}]
>
> ?
>
> Regards
> Jens
>
I like this solution, because it "automagically" skips rows with zeros only.
But why not simply "Except[0]" instead of "a_/;a=!=0"?
Cheers,
Peter