MathGroup Archive 2004

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

Search the Archive

Re: Simple Module Code

  • To: mathgroup at
  • Subject: [mg49571] Re: Simple Module Code
  • From: Bill Rowe <readnewsciv at>
  • Date: Fri, 23 Jul 2004 06:01:34 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

On 7/22/04 at 2:45 AM, umdougmm at (Doug) wrote:

>Does anyone know why the following code would not work inside a
>module? list = AppendTo[list, data];

>here's the exact code splitData[data_, list_, i_] := Module[{},
>Print["In Split Data ", i];

>If[data[[i,1]]==1, list = AppendTo[list, data[[i, 2]]]];
>Print["Length of list is: ", Length[list]];

>which is called by: Do[splitData[data, list, i], {i, 1,

>It complains about to many recursions, yet on the command line
>alone, list = AppendTo[list, data]; works just fine?

It appears your goal is to extract column 2 from a data list having at least two columns. If so, you are certainly doing things the hard way. If data is a n x m matrix, then

c = data[[All, 2]] will be vector with the values of column 2, i.e.,

data = Table[Random[], {i, 5}, {j, 5}]; 
c = data[[All,2]]; 
And @@ MapThread[#1 == #2[[2]]&, {c, data}]

To reply via email subtract one hundred and four

  • Prev by Date: Re: Simple Module Code
  • Next by Date: Further information about size limits for Normal[SparseArray[<>]]?
  • Previous by thread: Re: Simple Module Code
  • Next by thread: Re: Simple Module Code