MathGroup Archive 2001

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

Search the Archive

Re: Conditions

  • To: mathgroup at
  • Subject: [mg29247] Re: Conditions
  • From: BobHanlon at
  • Date: Fri, 8 Jun 2001 04:15:34 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

In a message dated 2001/6/7 1:28:18 AM, Yannis.Paraskevopoulos at 

>assume that we have a matrix m with dimensions (RxC) then create a 
>vector v, which has value 0 when there is a zero at any point across 
>m's row. Otherwise v's value would be equal to the last value of the 
>corresponding m row.
>I tried for example:
>I initiated a vector v={a,b}. I had to that as 
>Out:= {1,1} when I expected {0,1}
>I also tried
>v:=0 /; g/.x_:>x==0
>with same results.

Assuming that I understood your intent, then

v = (If[FreeQ[#,0],Last[#],0]&/@m)

Bob Hanlon
Chantilly, VA  USA

  • Prev by Date: Fourth degree polynomial
  • Next by Date: Replacing 1 to many in a list
  • Previous by thread: Conditions
  • Next by thread: Re: Conditions