Re: Conditions

• To: mathgroup at smc.vnet.net
• Subject: [mg29252] Re: Conditions
• From: bghiggins at ucdavis.edu (Brian Higgins)
• Date: Fri, 8 Jun 2001 04:15:37 -0400 (EDT)
• References: <9fna8p\$bih\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Yannis, Try this

myMatrix = Table[Random[Integer, {0, 10}], {10}, {7}];
nRow = First[Dimensions[myMatrix]];
nCol = Last[Dimensions[myMatrix]];
Table[If[Length[Cases[myMatrix[[j]], x_ /; x == 0]] > 0, v[j] = 0,
v[j] = myMatrix[[j, nCol]]], {j, 1, nRow}]

Cheers,

Brian

Yannis.Paraskevopoulos at ubsw.com wrote in message news:<9fna8p\$bih\$1 at smc.vnet.net>...
> Hi again,
>
> I've been puzzled by the following problem which I  have to admit it's
> not complicated but yet...
>
> 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
>
> Table[If[m[[i,j]]==0,v[[i]]=0,v[[i]]=g[[i,5]]],{i,2},{j,5}];
> v
>
> Out:= {1,1} when I expected {0,1}
>
>
> I also tried
>
>
> v:=0 /; g/.x_:>x==0
> v:=Table[g[[i,5]],{i,2}]
>
> with same results.
>
> Its obvious to me that I do something stupid but I can't figure it out.
> Any help would be very much appreciated.
>
> Best regards
>
>
> yannis
>
>
>
> This message contains confidential information and is intended only
> for the individual named.  If you are not the named addressee you
> should not disseminate, distribute or copy this e-mail.  Please
> notify the sender immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your system.
>
> E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses.  The sender therefore
> does not accept liability for any errors or omissions in the contents
> of this message which arise as a result of e-mail transmission.  If
> verification is required please request a hard-copy version.  This
> message is provided for informational purposes and should not be
> construed as a solicitation or offer to buy or sell any securities or
> related financial instruments.

```

• Prev by Date: Control ListContourPlot and LabelContourLines
• Next by Date: Re: Conditions
• Previous by thread: Re: Conditions
• Next by thread: Re: Conditions