MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Given a matrix, find position of first non-zero element in each


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


  • Prev by Date: Re: problems with DSolve
  • Next by Date: Re: Help with an error with NonlinearModelFit,
  • Previous by thread: Re: Given a matrix, find position of first non-zero element in each
  • Next by thread: Re: Given a matrix, find position of first non-zero element in each