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 | Intent | Optional | 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 |
|
character(len=*), | intent(in), | optional | :: | real_fmt |
if |
|
logical, | intent(in), | optional | :: | trim_str |
if |
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