Re: Export
- To: mathgroup at smc.vnet.net
- Subject: [mg128120] Re: Export
- From: "Nasser M. Abbasi" <nma at 12000.org>
- Date: Mon, 17 Sep 2012 00:22:08 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
- References: <k33uoa$qtv$1@smc.vnet.net>
- Reply-to: nma at 12000.org
On 9/16/2012 2:22 AM, Adel Elsabbagh wrote: > Dear friends, > > I am trying to export a 30*30 matrix (M) with entries function in x and y > to a txt file in order to use it by another program. I am using: > Export["filename.txt",M]. I have two problems: > 1. I want to reduce the precision of the coefficients of x & y. When I use > N[M,n] or SetPrecision[M,n], the precision is reduced within the Notebook > but not in the exported file. How to reduce the precision in the exported > file? > 2. Some entries look like "5*x + 3*y", which leaves spaces around the plus > or minus signs. Is there a way to tell Mathematica not leave these spaces > because the other program assumes that this is a new column? > > I also tried to write M//InputForm and just copy and past it, but I get a > lot of expressions such as 1.935*^-6 which the other software cannot > understand. Is there a way to write it in the form: 1.935e-6? > > Thanks in advance > Exporting an importing binary data between programs is something that has to be done with lots of care, assuming you want to do it right. Different programs, different hardware, different floating points representations, Big Endian / Little Endian and other such things can affect this process. The better way is to export the data to plain text format. (may be using standard format such as base64). When data in text, it can be read by many other system. Then converted back to binary after reading using the new system functions. http://reference.wolfram.com/mathematica/ref/format/Base64.html --Nasser