Fortran 90 write to file format




















I hope you do not try to run your code with different M and N on x array? In older fortran you need an actual number eg. What I want is row by row like the way it is stored in code.

Vec is allocatable array Vec N,M , so don't worry its legitimacy Mhm, your code works fine with me - for both gfortran 4. Which version of ifort are you using? Add a comment. Active Oldest Votes. Improve this answer. That's the Fortran unlimited format item and supported at least by current versions of ifort and gfortran. See here. Just out of curiosity: What is the benefit of the implicit loop over the partial array in the previous answer?

AlexanderVogt no difference here, since real can take a vector or scalar argument. Alexander Vogt Alexander Vogt I'm fresh in ifort so I didn't really get your idea. Thank you. Is it some times of the colume number? I'm considering your advice "writing matrix row-by-row". You specify the record length in the open statement, I think the number specified there takes precedence.

I added some example code to the answer without an explicit RECL. Show 1 more comment. Sign up or log in Sign up using Google. You want to have what in separate columns? Please source the declarations so that we can suggest appropriate formats. The examples in the answers of I formats won't work. Add a comment. Active Oldest Votes. Improve this answer. Hristo Iliev Hristo Iliev This feature, unlimited format item, is part of the Fortran standard.

I didn't know about that feature in F - very welcome addition, really. HristoIliev, If I have real numbers to print then how to go about. Regarding formatting, as ' 10 2I4 ', this wasn't working.

G can be used to automatically select between E or F based on the value to be printed and the width of the output field. Chris Chris But instead of nice bunch of numbers in columns I get some binary-like text. So there is something wrong with formatting I suppose. GEdit wouldn't even open the file. Can you post a minimal example of your code? How data is written to file is determined by the arguments passed to the open command, without your code it is impossible to tell exactly what is going on.

Nothing like that is in the standard Fortran. Sign up or log in Sign up using Google. If the open statement is successful then the ios value returned is zero else a non-zero value. It shows the prior status of the file. A scratch file is created and deleted when closed or the program ends. It is the file access mode. It gives the formatting status of the file. After the file has been opened, it is accessed by read and write statements. Once done, it should be closed using the close statement.



0コメント

  • 1000 / 1000