My results array is called datacsv and is filled in correctly. I’m trying to write a .csv file to be read by a plotting program. The number of parameters fluctuates depending on user input to the program. Here is the format statement and the write statement:
316 format(1p g20.10,99999(",",g20.10))
do k = 1 , nslices
write(32,316) (datacsv(listpar(i,j),k),j = 1 , npid(i))
enddo
The numbers appear in the file just fine separated by commas but a trailing comma appears in every line. The plotting program does not like that trailing comma. What would be the correct format to prevent the trailing commas?
The problem is the “99999”. When this format is being processed, the run time is expecting 99999 data items or until one too many items have been printed. It doesn’t know that it’s past the end until the “g20.10” is processed, in which case the extra “,” has already been printed. You’ll probably need to explicitly write out each element and use “ADVANCE=‘NO’” so a new line is not added. Something like: