MathGroup Archive 2005

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

Search the Archive

Re: Outputing a tabular function

  • To: mathgroup at
  • Subject: [mg54957] Re: Outputing a tabular function
  • From: Peter Pein <petsie at>
  • Date: Tue, 8 Mar 2005 05:03:42 -0500 (EST)
  • References: <d0gv9j$7m3$>
  • Sender: owner-wri-mathgroup at

Clifford Martin wrote:
> In some code I've written I output a table. In
> Mathematica I use TableForm in the usual way then use
> columns of data to fill the table. It looks nice in
> Mathematica. But my customer wants to be able to pull
> the file up in Excel.  I've tried various export
> formats but since the tables are made up of columns of
> data that are just lists it writes the lists as rows 
> Any suggestions about exporting the data so it can be
> read in an external program and look like a table? (I
> should add that I iterate over many sets of data and
> so there are multiple tables that print out. I capture
> the data in a function that I try to Export). Any
> suggestions appreciated.
> Cliff
Hi Cliff,

if all columns have got the same number of rows, simply
Transpose[yourTable] before Export[]ing it. Else for instance:
 t=Table["col."<>ToString[i]<>" row "<>ToString[j],{i,3},
{{col.1 row 1,col.1 row 2,col.1 row 3},
 {col.2 row 1,col.2 row 2,col.2 row 3, col.2 row 4,col.2 row 5,col.2
row6,col.2 row 7,col.2 row 8},
 {col.3 row 1, col.3 row 2,col.3 row 3,col.3 row 4,col.3 row 5}}

Fill each list of the Table with the empty string (or what you want) and
_then_ Transpose[] it:

{{col.1 row 1,col.2 row 1,col.3 row 1},
 {col.1 row 2,col.2 row 2,col.3 row 2},
 {col.1 row 3,col.2 row 3,col.3 row 3},
 {,col.2 row 4,col.3 row 4},
 {,col.2 row 5,col.3 row 5},
 {,col.2 row 6,},
 {,col.2 row 7,},
 {,col.2 row 8,}}

Now you can export it and the columns and rows appear as expected (at
least in Open Office 1.1.4):

Peter Pein

  • Prev by Date: Re: Help on iteration
  • Next by Date: Re: Help on iteration
  • Previous by thread: Re: Outputing a tabular function
  • Next by thread: Help on iteration