MathGroup Archive 2008

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

Search the Archive

Re: genetic algorithms

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92633] Re: genetic algorithms
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 9 Oct 2008 06:34:48 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <200809231137.HAA01052@smc.vnet.net> <gci1tc$jd$1@smc.vnet.net>

Tugrul Temel wrote:

> With the following command I am able to create a table with (10 rows, 4
> columns). I want to export this table in the same format to an Excel
> worksheet to do some more calculations. I need some help.
>  
> Print[ TableForm[postDist, TableHeadings -> {{}, {"Variable", "Post-mean",
> "Post-se"}}] ];

Look in the online help for *Export*. Also, you should prepend the 
header to the data and export the resulting list. For instance,

In[14]:= postDist = RandomInteger[1, {10, 4}]
sheet = Prepend[postDist, {"Variable", "Post-mean", "Post-se", ""}]
Export["myFile.xls", sheet]

Out[14]= {{1, 1, 0, 0}, {1, 0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 1}, {1,
   0, 0, 1}, {0, 0, 1, 1}, {1, 0, 0, 0}, {0, 0, 1, 0}, {1, 0, 1,
   0}, {1, 1, 1, 1}}

Out[15]= {{"Variable", "Post-mean", "Post-se", ""}, {1, 1, 0, 0}, {1,
   0, 0, 0}, {0, 0, 1, 0}, {0, 1, 0, 1}, {1, 0, 0, 1}, {0, 0, 1,
   1}, {1, 0, 0, 0}, {0, 0, 1, 0}, {1, 0, 1, 0}, {1, 1, 1, 1}}

Out[16]= "myFile.xls"


HTH,
-- Jean-Marc



  • Prev by Date: Re: How to print TraditionalForm without evaluation
  • Next by Date: Re: Line Spacing and Page Layout
  • Previous by thread: Re: genetic algorithms
  • Next by thread: $Assumptions