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

MathGroup Archive 2010

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

Search the Archive

Re: Exporting a List of Tables with different Lengths to a tabulator

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110641] Re: Exporting a List of Tables with different Lengths to a tabulator
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Wed, 30 Jun 2010 01:49:37 -0400 (EDT)

On 6/29/10 at 8:27 AM, h.maeter at gmail.com (hemke) wrote:

>I am trying to export some data I imported and then manipulated with
>mathematica. I have a List of several Tables, i.e.

>ListA={TableA, TableB, TableC, ...}

>A typical Table looks like this:

>TableA={{1,2},{4,5},...}.

>The Tables in ListA all have the same number of columns but
>differing number of rows.  Now, I want to export these Tables into
>one tabulator separated file with the same structure, i.e. line N in
>the output file should contain the elements in row N of each Table,
>or in other words I want the following:

>TableA[[1,1]]  TableA[[1,2]]   TableB[[1,1]]   TableB[[1,2]]   ...
>TableA[[2,1]]  TableA[[2,2]]   TableB[[2,1]]   TableB[[2,2]]   ...
>...        ...     ...     ...
>TableA[[M-1,1]]    TableA[[M-1,2]] TableB[[P,1]]   TableB[[P,2]]   ...
>TableA[[M,1]]  TableA[[M,2]]                   ...

It appears that you want the output file to have one table
followed immediately by another. If so,

Export["myfile.dat", Join@@ListA]

will do the trick

Something a little fancier would be

sep=Table["",{Dimensions[First@ListA][[2]]}];
Export["myfile.dat", Join@@(Append[#, sep]&/@ListA)]

This will write a blank line after each table in the resulting file.



  • Prev by Date: Re: numerical integration
  • Next by Date: Re: precedence for ReplaceAll?
  • Previous by thread: Exporting a List of Tables with different Lengths to a tabulator
  • Next by thread: Re: Exporting a List of Tables with different Lengths to a tabulator