Recent content by kranthi4689

  1. K

    I'm getting garbage values while reading matrices from a file

    It worked Thank you. Could you kindly recommend a book or site or some material from where I can learn fortran efficiently. Thank you.
  2. K

    I'm getting garbage values while reading matrices from a file

    reading it out the loop is giving a fortran runtime error.
  3. K

    I'm getting garbage values while reading matrices from a file

    I rectified the code to address the errors, but I still get segmentation faults. read (20,*) (vecy(i), j = 1,10) ! read column index do i = 1,16 do j = 1,min(i,10) read(20,*,end=100) vecx(i) , hamilt(i,j) ! row index and matrix elements...
  4. K

    I'm getting garbage values while reading matrices from a file

    @WWGD I just want to read them and write them in a separate txt file.
  5. K

    I'm getting garbage values while reading matrices from a file

    Hi All, While trying to read a matrix from data file using fortran90 code ,I get garbage values and a backtrace error. Error termination. Backtrace: #0 0x7f4a4de3631a #1 0x7f4a4de36ec5 #2 0x7f4a4de3768d #3 0x7f4a4dfa4d42 #4 0x7f4a4dfa6ad5 #5 0x7f4a4dfa80f9 #6 0x56040bbeae57 #7...
  6. K

    Fortran Runtime error while reading file in fortran90

    I'm new to fortran coding and trying to read a file called "data.dat" with data like a triangular matrix 0.1 0.1 0.2 0.1 0.2 0.3 0.1 0.2 0.3 0.4 0.1 0.2 0.3 0.4 0.5 using the code PROGRAM matrix IMPLICIT NONE REAL, DIMENSION(5,5) :: a INTEGER :: row,col,max_rows,max_cols max_rows=5...
  7. K

    Fortran How do I find an exact line from a large file in fortran90

    I got it now. I was missing a space in the initial file. sorry for the trouble . and thank you for your inputs. @FactChecker @Mark44 @DrClaude @anorlunda
  8. K

    Fortran How do I find an exact line from a large file in fortran90

    thank you for the quick edit, but even then the code doesn't read the said line. Can you tell me where is it I am going wrong
  9. K

    Fortran How do I find an exact line from a large file in fortran90

    Sorry, I don't understand. what is it that's missing
  10. K

    Fortran How do I find an exact line from a large file in fortran90

    I tried your solution u I tried to read the line. but it is not reading it. I did exactly like you said. program read_mat implicit none integer ::ios,i character (len =39) :: str_name character (len=1000) :: line str_name='OVERLAP MATRIX - CELL N. 1( 0 0 0)'...
  11. K

    Fortran How do I find an exact line from a large file in fortran90

    I did try that approach but for some reason, I cannot check for that string. I posted the code above. if possible could you look into it.
  12. K

    Fortran How do I find an exact line from a large file in fortran90

    I did that using a code from stackoverflow, but it is not working, program open_file implicit none integer ::ios character (len =39) :: str_name character , allocatable :: command(:) character (len=200) :: line integer :: n,i str_name = 'OVERLAP MATRIX - CELL N. 1( 0 0 0)'...
  13. K

    Fortran How do I find an exact line from a large file in fortran90

    No. Line number can vary from file to file. so I cannot use it.
Back
Top