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

MathGroup Archive 2009

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

Search the Archive

Re: Using For[] for Generating Multiple Output Cells

  • To: mathgroup at smc.vnet.net
  • Subject: [mg104920] Re: [mg104858] Using For[] for Generating Multiple Output Cells
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Fri, 13 Nov 2009 05:55:13 -0500 (EST)
  • Reply-to: hanlonr at cox.net

Since "Unless an explicit Return is used, the value returned by For is Null", use Print to generate an output.

Also, Partition throws away the last line unless it is a full line. Pad with two empty strings before Partition to obviate this problem.

Using a fixed ItemSize will make all the tables the same width.

For[x = 65, x < 91, x++, n0 = Join[
   Names[StringJoin["System`", FromCharacterCode[x], "*"]],
   {"", ""}];
 Print[Grid[Partition[n0, 3], Alignment -> Left,
   Frame -> All, ItemSize -> 10]]]


Bob Hanlon

---- BenT <brtubb at pdmusic.org> wrote: 

=============
Consider this v7 code which works as intended:

x = 65;
n0 = Names[
   StringJoin[
    "System`", FromCharacterCode[x], "*"
    ]
   ];
Grid[Partition[n0, 3], Alignment -> Left, Frame -> All]

And now consider this code which allows far more versatility, for
consecutive multiple outputs using the For[] function. BUT for some
reason it doesn't appear to work at all! Does anyone know why? Can it
be "fixed" as intended?

For[x = 65, x < 91, x++,
 n0 = Names[
   StringJoin[
    "System`", FromCharacterCode[x], "*"
    ]
   ];
 Grid[Partition[n0, 3], Alignment -> Left, Frame -> All]
 ]

--- Benjamin Tubb




  • Prev by Date: Re: Non-Linear pendulum
  • Next by Date: Re: Non-Linear pendulum
  • Previous by thread: Re: Using For[] for Generating Multiple Output Cells
  • Next by thread: Non-Linear pendulum