MathGroup Archive 2008

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

Search the Archive

Re: setting elements of an array based on a condition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87158] Re: setting elements of an array based on a condition
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Wed, 2 Apr 2008 05:57:49 -0500 (EST)
  • Organization: University of Bergen
  • References: <fsvejr$ssp$1@smc.vnet.net>

Claus wrote:
> Hello,
> I have one array, W, which for testing purposes has 25 rows and 50 columns.
> There are two more things I want to accomplish with this:
> 1) I want to set all elements of W which are smaller than zero to zero.

Clip[W, {0, Infinity}]

> 2) Then I want to calculate the sum of the elements in each column of W.
> How can I do this?

Plus @@@ W

or

Total /@ W


  • Prev by Date: Re: setting elements of an array based on a condition
  • Next by Date: Re: Defining a Play[] function for Drawbar Organ Emulation
  • Previous by thread: Re: setting elements of an array based on a condition
  • Next by thread: Re: setting elements of an array based on a condition