MathGroup Archive 2003

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

Search the Archive

Re: Export Complex Matrices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40779] Re: [mg40722] Export Complex Matrices
  • From: Dale Horton <daleh at wolfram.com>
  • Date: Thu, 17 Apr 2003 03:34:44 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

At 02:57 AM 4/15/2003, Kyriakos Chourdakis wrote:
>Dear all,
>
>I am trying to export matrices of the form
>
>COO = {{2, 3, 2. 10^-9}, {3, 2, 2. 10^-9 I}}
>
>with I the imaginary unit. It is the coordinate
>representation of large sparse matrices. The first two
>columns are the coordinates, and the third is the
>value. When I use the simple
>
>Export["COO.dat",COO]
>
>I guess Mathematica recognises the imaginary part as string,
>and exports
>
>2   3   2.e-9
>              -9
>3   2   2. 10   I
>
>instead of
>
>2   3   2.e-9
>3   2   2.e-9 I
>
>I am sure there is a simple way to get around the
>problem, but I can't find it..
>
>I am using Mathematica 4.0 on Windows Me.
>
>Best
>
>K.
>
>__________________________________________________
>Yahoo! Plus
>For a better Internet experience
>http://www.yahoo.co.uk/btoffer

You can pre-format your matrix before exporting. The following should do 
what you want.

  COO = {{2, 3, 2. 10^-9}, {3, 2, 2. 10^-9 I}}
  ExportString[COO /. Complex[0, y_] :> ToString[CForm[y]] <> " I", "Table"]

-Dale



  • Prev by Date: Solving for a function in an Integral
  • Next by Date: Re: Copying and Pasting Output that has StyleForm
  • Previous by thread: Re: Export Complex Matrices
  • Next by thread: Re: Re: Export Complex Matrices