loadtxt Interface

public interface loadtxt

Loads a 2D array from a text file (Specification)


Module Procedures

private subroutine loadtxt_rsp(filename, d, skiprows, max_rows)

Loads a 2D array from a text file.

Arguments

Filename to load the array from

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

The array 'd' will be automatically allocated with the correct dimensions

real(kind=sp), intent(out), allocatable :: d(:,:)

Skip the first skiprows lines. If skipping more rows than present, a 0-sized array will be returned. The default is 0.

integer, intent(in), optional :: skiprows

Read max_rows lines of content after skiprows lines. A negative value results in reading all lines. A value of zero results in no lines to be read. The default value is -1.

integer, intent(in), optional :: max_rows

Example


 real(sp), allocatable :: data(:, :)
 call loadtxt("log.txt", data)  ! 'data' will be automatically allocated

Where 'log.txt' contains for example::

 1 2 3
 2 4 6
 8 9 10
 11 12 13
 ...

private subroutine loadtxt_rdp(filename, d, skiprows, max_rows)

Loads a 2D array from a text file.

Arguments

Filename to load the array from

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

The array 'd' will be automatically allocated with the correct dimensions

real(kind=dp), intent(out), allocatable :: d(:,:)

Skip the first skiprows lines. If skipping more rows than present, a 0-sized array will be returned. The default is 0.

integer, intent(in), optional :: skiprows

Read max_rows lines of content after skiprows lines. A negative value results in reading all lines. A value of zero results in no lines to be read. The default value is -1.

integer, intent(in), optional :: max_rows

Example


 real(dp), allocatable :: data(:, :)
 call loadtxt("log.txt", data)  ! 'data' will be automatically allocated

Where 'log.txt' contains for example::

 1 2 3
 2 4 6
 8 9 10
 11 12 13
 ...

private subroutine loadtxt_iint8(filename, d, skiprows, max_rows)

Loads a 2D array from a text file.

Arguments

Filename to load the array from

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

The array 'd' will be automatically allocated with the correct dimensions

integer(kind=int8), intent(out), allocatable :: d(:,:)

Skip the first skiprows lines. If skipping more rows than present, a 0-sized array will be returned. The default is 0.

integer, intent(in), optional :: skiprows

Read max_rows lines of content after skiprows lines. A negative value results in reading all lines. A value of zero results in no lines to be read. The default value is -1.

integer, intent(in), optional :: max_rows

Example


 integer(int8), allocatable :: data(:, :)
 call loadtxt("log.txt", data)  ! 'data' will be automatically allocated

Where 'log.txt' contains for example::

 1 2 3
 2 4 6
 8 9 10
 11 12 13
 ...

private subroutine loadtxt_iint16(filename, d, skiprows, max_rows)

Loads a 2D array from a text file.

Arguments

Filename to load the array from

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

The array 'd' will be automatically allocated with the correct dimensions

integer(kind=int16), intent(out), allocatable :: d(:,:)

Skip the first skiprows lines. If skipping more rows than present, a 0-sized array will be returned. The default is 0.

integer, intent(in), optional :: skiprows

Read max_rows lines of content after skiprows lines. A negative value results in reading all lines. A value of zero results in no lines to be read. The default value is -1.

integer, intent(in), optional :: max_rows

Example


 integer(int16), allocatable :: data(:, :)
 call loadtxt("log.txt", data)  ! 'data' will be automatically allocated

Where 'log.txt' contains for example::

 1 2 3
 2 4 6
 8 9 10
 11 12 13
 ...

private subroutine loadtxt_iint32(filename, d, skiprows, max_rows)

Loads a 2D array from a text file.

Arguments

Filename to load the array from

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

The array 'd' will be automatically allocated with the correct dimensions

integer(kind=int32), intent(out), allocatable :: d(:,:)

Skip the first skiprows lines. If skipping more rows than present, a 0-sized array will be returned. The default is 0.

integer, intent(in), optional :: skiprows

Read max_rows lines of content after skiprows lines. A negative value results in reading all lines. A value of zero results in no lines to be read. The default value is -1.

integer, intent(in), optional :: max_rows

Example


 integer(int32), allocatable :: data(:, :)
 call loadtxt("log.txt", data)  ! 'data' will be automatically allocated

Where 'log.txt' contains for example::

 1 2 3
 2 4 6
 8 9 10
 11 12 13
 ...

private subroutine loadtxt_iint64(filename, d, skiprows, max_rows)

Loads a 2D array from a text file.

Arguments

Filename to load the array from

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

The array 'd' will be automatically allocated with the correct dimensions

integer(kind=int64), intent(out), allocatable :: d(:,:)

Skip the first skiprows lines. If skipping more rows than present, a 0-sized array will be returned. The default is 0.

integer, intent(in), optional :: skiprows

Read max_rows lines of content after skiprows lines. A negative value results in reading all lines. A value of zero results in no lines to be read. The default value is -1.

integer, intent(in), optional :: max_rows

Example


 integer(int64), allocatable :: data(:, :)
 call loadtxt("log.txt", data)  ! 'data' will be automatically allocated

Where 'log.txt' contains for example::

 1 2 3
 2 4 6
 8 9 10
 11 12 13
 ...

private subroutine loadtxt_csp(filename, d, skiprows, max_rows)

Loads a 2D array from a text file.

Arguments

Filename to load the array from

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

The array 'd' will be automatically allocated with the correct dimensions

complex(kind=sp), intent(out), allocatable :: d(:,:)

Skip the first skiprows lines. If skipping more rows than present, a 0-sized array will be returned. The default is 0.

integer, intent(in), optional :: skiprows

Read max_rows lines of content after skiprows lines. A negative value results in reading all lines. A value of zero results in no lines to be read. The default value is -1.

integer, intent(in), optional :: max_rows

Example


 complex(sp), allocatable :: data(:, :)
 call loadtxt("log.txt", data)  ! 'data' will be automatically allocated

Where 'log.txt' contains for example::

 1 2 3
 2 4 6
 8 9 10
 11 12 13
 ...

private subroutine loadtxt_cdp(filename, d, skiprows, max_rows)

Loads a 2D array from a text file.

Arguments

Filename to load the array from

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: filename

The array 'd' will be automatically allocated with the correct dimensions

complex(kind=dp), intent(out), allocatable :: d(:,:)

Skip the first skiprows lines. If skipping more rows than present, a 0-sized array will be returned. The default is 0.

integer, intent(in), optional :: skiprows

Read max_rows lines of content after skiprows lines. A negative value results in reading all lines. A value of zero results in no lines to be read. The default value is -1.

integer, intent(in), optional :: max_rows

Example


 complex(dp), allocatable :: data(:, :)
 call loadtxt("log.txt", data)  ! 'data' will be automatically allocated

Where 'log.txt' contains for example::

 1 2 3
 2 4 6
 8 9 10
 11 12 13
 ...