TableSetRowCol Subroutine

public subroutine TableSetRowCol(tab, nrow, ncol)

set number of rows and columns and allocate variables Arguments: tab returned table nrow number of rows ncol number of columns

Arguments

Type IntentOptional Attributes Name
type(Table), intent(inout) :: tab
integer(kind=short), intent(in) :: nrow
integer(kind=short), intent(in) :: ncol

Variables

Type Visibility Attributes Name Initial
integer(kind=short), public :: i

Source Code

SUBROUTINE TableSetRowCol &
  ( tab, nrow, ncol )

IMPLICIT NONE

! Arguments with intent(in):
INTEGER (KIND = short), INTENT(IN) :: nrow
INTEGER (KIND = short), INTENT(IN) :: ncol

! Arguments with intent (inout):
TYPE (Table), INTENT (INOUT) :: tab

! local declarations:
INTEGER (KIND = short) :: i

!------------end of declaration------------------------------------------------

tab % noRows = nrow
tab % noCols = ncol

IF ( ASSOCIATED ( tab % col ) ) THEN
    DEALLOCATE ( tab % col )
END IF

ALLOCATE ( tab % col (ncol) )

DO i = 1, ncol
    tab % col (i) % header = '' 
    tab % col (i) % unit   = '' 
    ALLOCATE ( tab % col (i) % row (nrow) )
    tab % col (i) % row = ''
END DO

RETURN 
  END SUBROUTINE TableSetRowCol