I tried to make the output format dynamic in the sense that the number of variables to be printed can be varied dynamically. I conducted several experiments with the following two methods (see Context below), but both of them led to an error message of the following form:
forrtl: error (63): output conversion error, unit 1016, file / panfs / roc / Node _ 16.txt
The first method uses a string to specify the output format, for example
real a(4) = [1 2 3 4]
int size = 4
write(string,'(a,i3,a)') '(a,',size,'(f9.4))'
write(*, string) a(:)
The second method is what I just found out from the Internet, which takes up only one line, but it doesn’t work either:
write(*,'(a,<size>f9.4)') a(:)
Please help me with setting this format. Thank.
EDIT: . "a" , f9.4 . , f9.4 - e11.3.