Excluding characters in Fortran

  • Context: Comp Sci 
  • Thread starter Thread starter doublemint
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

The discussion focuses on excluding specific characters or lines in Fortran code while processing data. The user, DoubleMint, is attempting to read a dataset containing energy values and corresponding F(E) values but struggles with removing the first two lines of the input. The response highlights that the issue may stem from printing uninitialized variables, suggesting a need for proper variable initialization and line exclusion techniques in Fortran.

PREREQUISITES
  • Understanding Fortran syntax and data types
  • Familiarity with file I/O operations in Fortran
  • Knowledge of variable initialization in programming
  • Basic data processing concepts
NEXT STEPS
  • Learn how to use Fortran's READ statement effectively to skip lines
  • Research techniques for initializing variables in Fortran
  • Explore Fortran's string manipulation functions for data processing
  • Investigate best practices for error handling in Fortran file I/O
USEFUL FOR

This discussion is beneficial for Fortran programmers, data analysts working with scientific data, and anyone involved in file processing and data manipulation in Fortran.

doublemint
Messages
138
Reaction score
0
Hello!

I am trying to write a code in Fortran to process the following data and write it into another file:

# energy (in eV), F(E) (in particles per m^2 per s per ster)

1.81E+17 8.3443E-28
2.26E+17 2.75658E-28
...

So far, I got the code to read everything, however, I can not get rid of the first two lines. Does anyone know how to?

Thanks
DoubleMint
 
Physics news on Phys.org
Show us what you have done. It looks to me like you are printing some garbage values - values of uninitialized variables.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 7 ·
Replies
7
Views
5K
  • · Replies 2 ·
Replies
2
Views
9K