add_matrix Subroutine

private subroutine add_matrix(me, val, int_fmt, real_fmt, trim_str)

Add a matrix to a CSV file. Each row is added as a new line. Line breaks are added at the end of each line (in this way it differs from the other add routines).

Type Bound

csv_file

Arguments

Type IntentOptional Attributes Name
class(csv_file), intent(inout) :: me
class(*), intent(in), dimension(:,:) :: val

the values to add

character(len=*), intent(in), optional :: int_fmt

if val is an integer, use this format string.

character(len=*), intent(in), optional :: real_fmt

if val is a real, use this format string.

logical, intent(in), optional :: trim_str

if val is a string, then trim it.


Calls

proc~~add_matrix~~CallsGraph proc~add_matrix csv_file%add_matrix none~add csv_file%add proc~add_matrix->none~add proc~next_row csv_file%next_row proc~add_matrix->proc~next_row none~add->proc~add_matrix proc~add_cell csv_file%add_cell none~add->proc~add_cell proc~add_vector csv_file%add_vector none~add->proc~add_vector proc~add_vector->none~add

Called by

proc~~add_matrix~~CalledByGraph proc~add_matrix csv_file%add_matrix none~add csv_file%add proc~add_matrix->none~add none~add->proc~add_matrix proc~add_vector csv_file%add_vector none~add->proc~add_vector proc~add_vector->none~add

Source Code

    subroutine add_matrix(me,val,int_fmt,real_fmt,trim_str)

    implicit none

    class(csv_file),intent(inout) :: me
    class(*),dimension(:,:),intent(in) :: val  !! the values to add
    character(len=*),intent(in),optional :: int_fmt  !! if `val` is an integer, use
                                                     !! this format string.
    character(len=*),intent(in),optional :: real_fmt !! if `val` is a real, use
                                                     !! this format string.
    logical,intent(in),optional :: trim_str !! if `val` is a string, then trim it.

    integer :: i !! counter

    ! add each row:
    do i=1,size(val,1)
        call me%add(val(i,:),int_fmt,real_fmt,trim_str)
        call me%next_row()
    end do

    end subroutine add_matrix