Solved

Digital Fortran 6.5 Question

Posted on 2002-05-07
7
218 Views
Last Modified: 2013-11-08
Hi All,

I'm trying to write the content of an 2-dimensional array (integers) to a comma seperated file. I have trouble to convert the numbers into a "string". I want to do things like this:

integer myarray(20,3)
! I fill the array here with data
open(10,'c:\tmp\file.dat',STATUS='REPLACE'
do n=1 to 20
  mystring=myarr(n,1)//','
  mystring=myarr(n,2)//','
  mystring=myarr(n,3)//','
  write (10,*) mystring
enddo
etc...

I do not really how to format the numbers and change them into a "string" so I can write them to the file the way I want.

Does anyone have any experience with this?

Thanks in advance.

Hing.
0
Comment
Question by:Hing
7 Comments
 
LVL 2

Expert Comment

by:jonnin
ID: 6994605
write it to an internal file and read it back out. there may be a cleaner way, all i can think of...
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 6994655
Would the following work?
 
write (10,*) myarr(n,1),",",myarr(n,2),",",myarr(n,3)

mlmcc
0
 

Author Comment

by:Hing
ID: 6995816
Thanks mlmcc,

I thought about that too, but the problem is that each line I've written to the file will wrap automatically, something I don't want to happen.

anyone other ideas?

Hing.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 100

Expert Comment

by:mlmcc
ID: 6997721
What do you mean the line or file wraps?  

Generally wrapping is a function of the display not the file.  

It's been a long time since I did any FORTRAN but I thought the line I gave you would do something like

45,56,78
23,43,65

mlmcc
0
 

Expert Comment

by:jespernaur
ID: 7240058
    write(10,20)myarr(n,1),myarr(n,2),myarr(n,3)
20   format(1x,i5,",",i5,",",i5)

This is a completely simple application of the FORTRAN FORMAT capability - you really should look into what else can be done

Best regards
Jesper Naur
0
 
LVL 54

Expert Comment

by:nico5038
ID: 7515090

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
 - PAQ'd and pts removed
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

Nic;o)
0
 

Accepted Solution

by:
Jgould earned 0 total points
ID: 7548151
Question has been closed as per recommendation

JGould-EE Moderator
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now