User defined data formats
Mosel also provides functions which allow you to read data in from and write data out to text files using any format (see list in Section Built in functions and procedures).
- Reading in free format data
-
declarations ii, jj: integer ! Don't use normal i,j end-declarations fopen('cost.dat', F_INPUT) while(not iseof) readln(ii, ',', jj, ',', COST(ii,jj)) fclose(F_INPUT)
- Writing out data in user format
-
fopen('xsol.dat', F_OUTPUT) forall(s in SUP, d in DEP) writeln(s, ',', d, ',', getsol(x(s,d))) fclose(F_OUTPUT)