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 an array

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113796] Re: exporting an array
  • From: Thomas Dowling <thomasgdowling at gmail.com>
  • Date: Sat, 13 Nov 2010 00:59:15 -0500 (EST)

Hello,

I am not sure I fully understand what you want.

Perhaps something like the following?

b = Table[b1[i], {i, 1, 200}];

newmat = (n = 1;
   Map[{ n++, #} &, b]);

Dimensions[newmat]
Out[85]= {200, 2}

To Export:

Export["new.txt", newmat]

Tom Dowling

On Thu, Nov 11, 2010 at 11:09 AM, nt <sagittarius5962 at gmail.com> wrote:

> Hi,
>
> I have a question on how to export a matrix. My code generates a
> vector of dimension (200 X 1), and I define:
>
> b = Table[b1[i] /. solution, {i, 1, 200}];
>
> I want to assign counters to these values, and have 1,2,3,.....,200 as
> the first column. Finally I want to export this (200 X 2) matrix to a
> file. I tried the following but they don't work:
>
> Export["file.txt", {i, 1, 2000}, b];
> Export["file.txt", i, b];
>
> I would appreciate it if anyone could suggest a way to do this.
>
> Thanks
> nt
>


  • Prev by Date: Re: Tensor Contraction
  • Next by Date: Re: Constructing matrix out of submatrices
  • Previous by thread: exporting an array
  • Next by thread: Re: exporting an array