36 character(len=*),
intent(in) :: filename
38 real(dp),
allocatable,
intent(out) :: d(:,:)
40 integer(i4),
intent(in),
optional :: skiprows
42 integer(i4),
intent(in),
optional :: max_rows
44 integer(i4) :: u, nrow, ncol, i, skiprows_, max_rows_
47 if (
present(skiprows) ) skiprows_ = max(skiprows, 0)
50 if (
present(max_rows) ) max_rows_ = max_rows
52 open(newunit=u, file=filename, action=
'read', position=
'asis', status=
'old', access=
'stream', form=
'formatted')
57 skiprows_ = min(skiprows_, nrow)
58 if ( max_rows_ < 0 .or. max_rows_ > (nrow - skiprows_)) max_rows_ = nrow - skiprows_
60 allocate(d(max_rows_, ncol))
67 read(u,
"(*(es24.16e3,1x))") d(i, :)
78 character(len=*),
intent(in) :: filename
80 real(sp),
allocatable,
intent(out) :: d(:,:)
82 integer(i4),
intent(in),
optional :: skiprows
84 integer(i4),
intent(in),
optional :: max_rows
86 integer(i4) :: u, nrow, ncol, i, skiprows_, max_rows_
89 if (
present(skiprows) ) skiprows_ = max(skiprows, 0)
92 if (
present(max_rows) ) max_rows_ = max_rows
94 open(newunit=u, file=filename, action=
'read', position=
'asis', status=
'old', access=
'stream', form=
'formatted')
99 skiprows_ = min(skiprows_, nrow)
100 if ( max_rows_ < 0 .or. max_rows_ > (nrow - skiprows_)) max_rows_ = nrow - skiprows_
102 allocate(d(max_rows_, ncol))
109 read(u,
"(*(es15.8e2,1x))") d(i, :)
120 integer(i4),
intent(in) :: u
129 read(u,
'(a)', advance=
'no', iostat=ios) c
142 integer(i4),
intent(in) :: u
148 read(u, *, iostat=ios)
Read a file into a 2D array containing reals.
subroutine loadtxt_sp(filename, d, skiprows, max_rows)
Read a file into a 2D array containing reals.
integer function, public number_of_columns(u)
Determine number of columns in a file. The columns are assumed to be separated by spaces or tabs.
integer function, public number_of_rows(u)
Determine number of rows in a file.
subroutine loadtxt_dp(filename, d, skiprows, max_rows)
Read a file into a 2D array containing reals.
Define number representations.
integer, parameter sp
Single Precision Real Kind.
integer, parameter i4
4 Byte Integer Kind
integer, parameter dp
Double Precision Real Kind.
Write out concatenated strings.
subroutine, public error_message(t01, t02, t03, t04, t05, t06, t07, t08, t09, t10, t11, t12, t13, t14, t15, t16, uni, advance, show, raise, reset_format)
Write out an error message to stderr and call stop 1.
pure logical function, public is_blank(c)
Check for blank characters.