Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Make a nested list in a loop!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112281] Re: Make a nested list in a loop!
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Tue, 7 Sep 2010 06:08:34 -0400 (EDT)
  • References: <i64keh$380$1@smc.vnet.net>

On Sep 6, 11:00 pm, Sebastian <sebpin... at googlemail.com> wrote:
> initdata = Import[datadir, "Data"];
> f = 1;
> Do[
>  If[omin <= initdata[[e, 2]] <= omax, data[f] = initdata[e]; f = f +
> 1]
> , {e, 1, Length[initdata]}];
>
> Can someone please help, I'm trying to create a nested list from some
> data that is already as a nested list. Basically initdata has loads of
> rows but only 5 columns and looks as follow:
>
> {{a,b,c,d,e},{f,g,h,i,j},{k...etc.
>
> I'm trying to reduce the number of rows by comparing the 2nd column of
> each row to a predefined maximum and minimum (omax, omin
> respectively). Then if this value is accepted, the whole row gets
> nested into the new 'data' array.
>
> Running the code as is above I get the following errors:
>
> "Symbol::argx: Symbol called with arguments; 1 argument is expected"
>
> Thanks for any help in advance.
> Seb

data = Select[initdata, omin <= #[[2]] <= omax &]


  • Prev by Date: Re: Holding arguments of a family of functions
  • Next by Date: Re: Sorting a list of names
  • Previous by thread: Make a nested list in a loop!
  • Next by thread: A dragging matter of Interpretation