I want to write a 2D array into a csv file for visualization. However, the text is output as follows: 0 0 0 0 0
and I cannot open is properly.
inscoop
is a an array of booleans of size (nx+1, ny+1)
. It can be at most (100,100)
or (150,150)
. I want the output to be formatted as 0, 0, 0 n 0, 0, 0
, you know the usual csv format.
The code that I am using is as follows:
OPEN(UNIT=12, FILE="./output/aoutput.csv", ACTION="write", STATUS="replace")
DO i=1,nx+1
WRITE(12,*) (inscoop(i,j), j=1,ny+1)
END DO
New contributor
lokit khemka is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.