WRITE

formats

 Syntax: WRITE\FORMAT file (format) x1 { x2 ... }
         WRITE\SCALAR\FORMAT file (format) s1 { s2 ... }
         WRITE\MATRIX\FORMAT file (format) matrix                               

 By default, free format is used. Use the \FORMAT qualifier to indicate a
 format is present. The format must be enclosed in parentheses, ( and ).
 Any standard Fortran format is valid, but only REAL variables can be
 written. Do not use INTEGER, LOGICAL or CHARACTER formats.  

 You may use the PHYSICA defined format BINARY, minimum abbreviation B,
 to write binary unformatted files containing 8 byte numbers. 

1_example

 If you have a vector, for example, X, and enter WRITE FILE.DAT X X X
 then the following lines will be written to the file:
 X(1) X(2) X(3)
 X(4) X(5) X(6)
 ...

2_example

 Examples: WRITE FILE.DAT X Y Z  
           WRITE\FORMAT FILE.DAT (*) X Y Z   
           WRITE\FORMAT FILE.DAT ('X=',F10.3,' Y=',F7.1,' Z=',F9.2) X Y Z   
           WRITE\FORMAT FILE.DAT (B) X Y Z   
           WRITE\APPEND FILE.DAT X Y Z  
           WRITE\SCALAR FILE.DAT A B C  
           WRITE\SCALAR\FORMAT FILE.DAT ('string ',3(F10.3)) A Y[3] C   
           WRITE\SCALAR\APPEND FILE.DAT A B C   
           WRITE\SCALAR\FORMAT FILE.DAT (B) A B C  
           WRITE\MATRIX\APPEND FILE.DAT M[1:100,1:10]  
           WRITE\MATRIX\FORMAT FILE.DAT (7F10.3,2X) M[1:100,1:10]  
           WRITE\TEXT FILE.DAT `Text string'
           WRITE\TEXT FILE.DAT T3
           WRITE\TEXT\APPEND FILE.DAT `A = '//RCHAR(A)//`, B = '//RCHAR(B)  
           WRITE\TEXT FILE.DAT `X['//RCHAR(J,`F2.0')//`] = '//RCHAR(X[J])
           WRITE\TEXT\APPEND FILE.DAT `A = '//RCHAR(A,`F10.3')

Additional Information on:

  • 3_example
  • 4_example

     To write the vectors X, Y and Z to DUM.DAT using a
     specified format, enter: 
       WRITE\FORMAT DUM.DAT (' X=',F6.2,' Y=',F6.2,' Z=',F6.2) X Y Z
     and DUM.DAT will look like:
      X=123.45 Y=-23.45 Z= 23.45
      X=124.45 Y=-24.45 Z= 24.45
      X=125.45 Y=-25.45 Z= 25.45
      X=126.45 Y=-26.45 Z= 26.45
      ...      ...      ... 
    

    SCALAR

     Syntax: WRITE\SCALAR file s1 { s2 ... }
             WRITE\SCALAR\FORMAT file (format) s1 { s2 ... }
    
     The WRITE\SCALAR command writes scalars to a file. If \APPEND is used, and
     if the output file already exists, the data will be appended onto the end
     of the file.  One line will be written to the file which will contain
     columns of data, where the I_th column will be scalar sI. A maximum of 29
     scalars can be written with one WRITE\SCALAR command. 
    

    Additional Information on:

  • example
  • MATRIX

     Syntax: WRITE\MATRIX file matrix
             WRITE\MATRIX\FORMAT file (format) matrix
    
     The WRITE\MATRIX command writes a matrix to a file. If \APPEND is used,
     and if the output file already exists, the data will be appended onto the
     end of the  file. 
    

    TEXT

     Syntax: WRITE\TEXT file txtvar
    
     The WRITE\TEXT command writes writes a character string to a file. If
     \APPEND is used, and if the output file already exists, the string will be
     appended onto the end of the file.
    

    Additional Information on:

  • 1_example
  • 2_example