MathGroup Archive 1996

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

Search the Archive

FortranForm ... help..

  • To: mathgroup at smc.vnet.net
  • Subject: [mg3665] FortranForm ... help..
  • From: george at mech.seas.upenn.edu ( George Jefferson )
  • Date: Tue, 2 Apr 1996 21:56:34 -0500
  • Organization: Mechanical Engineering
  • Sender: owner-wri-mathgroup at wolfram.com

seems like a simple task. I have an expression and I want
to write the FortranForm of the assignment statemant:

      x = expression

of course fortran requires proper column placement, so we try
Write["file","      ",FortranForm[x],"=",FortranForm[expr]]

This is no good, because the FortranForm function doesn't know
about the right margin and the statement doesn't wrap properly.

next try:

ff=OpenWrite["file", FormatType -> FortranForm , PageWidth -> 75 ];
Write[ff,"      ",x,"=",expression];

now it wraps properly ( with continuation markers ), but the quoted
strings are printed with the quote marks..

maybe you could just do:
Write[ff,expression];

then go back and add the "X=" manually..but look. The FortranForm
writes the first line of the expression starting from column 1,
then continued lines properly start at column 6.  The result
is that we need to set the PageWidth about 8 columns too narrow
so that we have room for "bbbbbbx=" in front..

Any *elegant* solutions?



==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: 3D real-time Visualization
  • Next by Date: Font changes within a label??
  • Previous by thread: Re: 3D real-time Visualization
  • Next by thread: Font changes within a label??