Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9197 > unrolled thread

Exporting a formula to Excel via copypaste

Started byruesche83@gmail.com
First post2012-03-22 10:52 +0000
Last post2012-03-23 06:31 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Exporting a formula to Excel via copypaste ruesche83@gmail.com - 2012-03-22 10:52 +0000
    Re: Exporting a formula to Excel via copypaste A Retey <awnl@gmx-topmail.de> - 2012-03-23 06:31 +0000

#9197 — Exporting a formula to Excel via copypaste

Fromruesche83@gmail.com
Date2012-03-22 10:52 +0000
SubjectExporting a formula to Excel via copypaste
Message-ID<jkf09d$8kq$1@smc.vnet.net>
Hi there

I'm trying to copy a fromula from mathematica a and paste it to excel. It is a  polynomial. Something like:

-0.00488067+0.000981042 dff+0.000109406 dff^2+1.83066*10^-8

Now, there are two problems:
- The exponential is written as 10^-8. Which is not compatible with excel. This issue can be solve by using ScientificForm.
- The second problem: Excel wants asterisks (*) for the multiplication. This is solved by doing it this way: ScientificForm[rhofit, NumberMultiplier -> "*"]

Now, the problem is, that NumberMultiplier only adds asterisks where you have number, but not if you have variables. Any idea to replace the spaces with asterisks?

Any help would be highly appreciated.
Philipp

[toc] | [next] | [standalone]


#9204

FromA Retey <awnl@gmx-topmail.de>
Date2012-03-23 06:31 +0000
Message-ID<jkh5cp$jr7$1@smc.vnet.net>
In reply to#9197
Hi,

> I'm trying to copy a fromula from mathematica a and paste it to
> excel. It is a  polynomial. Something like:
>
> -0.00488067+0.000981042 dff+0.000109406 dff^2+1.83066*10^-8
>
> Now, there are two problems: - The exponential is written as 10^-8.
> Which is not compatible with excel. This issue can be solve by using
> ScientificForm. - The second problem: Excel wants asterisks (*) for
> the multiplication. This is solved by doing it this way:
> ScientificForm[rhofit, NumberMultiplier ->  "*"]
>
> Now, the problem is, that NumberMultiplier only adds asterisks where
> you have number, but not if you have variables. Any idea to replace
> the spaces with asterisks?

I would suggest to start from either CForm or FortranForm and adjust the 
details with StringReplace, e.g. the following should work:

StringReplace[
  ToString[FortranForm[-0.00488067 + 0.000981042 dff +
     0.000109406 dff^2 + 1.83066*10^-8 dff^3]],
  {"**" -> "^","dff"->"A1"}
  ]

which will result in:

"-0.00488067 + 0.000981042*A1 + 0.000109406*A1^2 + 1.83066e-8*A1^3"

which I think excel should accept as a formula (at least it did for 
after removing for the double quotes and replacing . with , since I have 
a German version)...

hth,

albert

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web