Re: formatting matrix in fortran90

On Dec 2, 8:22 pm, Schokoholic <mrt.marine...@xxxxxxxxx> wrote:
Hi everyone,

i need your help!!!

i am tring to formatting a matrix of dimensione 10xN+1

wha i am trying to do is following:

<value> <index>:<value>...... etc. for each row

the values in the first column do not need a "index".

how can i do that???

there is what i have done.. but it doesn't seem to work out properly:

                 DO 2 j_train=1,10

                        DO 1 i_train=2,n+1

                1       write(1,180) mat_data(j_train,1),i_train-1,mat_data

                2       write(1,*)

                180 FORMAT(1X,F20.1,I3,':',1X,F20.15,$)

is there anyone able to help me???

it's  important...

Does this help?

program test_csv
implicit none
integer :: mat_data(10, 5) = 1.0, n, i_train, j_train
n =4
DO j_train=1,10
write(1,180) mat_data(j_train,1),(i_train-1,mat_data
(j_train,i_train) ,i_train=2,n+1 )
end do
180 FORMAT(1X,F20.15,5(I3,':',1X,F20.15))
end program


Mike Metcalf