Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PLOTTING - MICROSOFT DEVELOPER STUDIO FORTRAN

1 view
Skip to first unread message

Duncan1943

unread,
Feb 19, 2003, 4:45:14 PM2/19/03
to
The plotting capability within the Fortran Program is very poor. I would like
to export data files from a Fortran program I have written int EXCEL for
preparing plots. Can someone give me help on how to do this?

Duane Bozarth

unread,
Feb 19, 2003, 5:08:27 PM2/19/03
to

You can either use direct communication w/Excel from Fortran or write
data files out to be imported. If the latter, I would suggest writing
them as CSV formatted files as the importing by Excel is reliable. To
do this, simply add double quotes (") around any text containing
embedded blanks and follow each field with a comma.

A Write statement such as

write(10,'(F10.3,)') x, y, z

will work fine--the trailing comma will not matter. You can get more
sophisticated and eliminate the extra comma if you desire.

I'll note that space-delimited files work, also, but I've occasionally
had the text importer not separate the columns correctly, I don't know
why...

Paul Curtis

unread,
Feb 20, 2003, 10:52:17 AM2/20/03
to
The "plotting capability" of Fortran is excellent, but realization of
output graphics
is obviously highly dependent on the hardware being addressed, which is
in turn
usually operating-system dependent as well. Which means that plotting code
will rely on opsys API routines to translate the output to the hardware
layer.

Windows has an abundance of GDI and other calls available for this purpose,
which work superbly and are easy to use. It is also not difficult to
export values
directly into Excel spreadsheets. Examples of how to do the latter are
included
with the Compaq (CVF) compiler. Examples of using Win32 API routines for
graphics output are everywhere; try Petzold's book for starters.

Duncan1943

unread,
Feb 20, 2003, 1:24:19 PM2/20/03
to
Thanks, the trouble is though x,y,z seem to get written into one cell of EXCEL
for each write execution. For the first write I want x,y,z to go into Excel
cells a1, b1,c1.
Duncan

Duane Bozarth

unread,
Feb 20, 2003, 1:59:36 PM2/20/03
to

I've not done it specifically (I <hate> Excel's chart object so rarely
use it <g>), but sounds like you're not incrementing the target row and
column. I don't think there's a way to write multiple values without
changing the target cell address (unless you make an array reference or
some such). But, I'm no expert on the direct communication route, so
someone else may well show you a better way.

0 new messages