WRITE_XYY_DATA writes a table of data to a file, for plotting by GNUPLOT.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*) | :: | data_file_name | ||||
integer | :: | lda | ||||
integer | :: | nrow | ||||
integer | :: | ncol | ||||
real | :: | x(lda,ncol) | ||||
integer | :: | ierror |
subroutine write_xyy_data ( data_file_name, lda, nrow, ncol, x, ierror ) ! !******************************************************************************* ! !! WRITE_XYY_DATA writes a table of data to a file, for plotting by GNUPLOT. ! ! ! Discussion: ! ! The first column of data is assumed to be the independent variable, X. ! Separate plots are made of X versus all the other columns of data. ! ! Modified: ! ! 21 February 2001 ! ! Author: ! ! John Burkardt ! ! Parameters: ! ! Input, character ( len = * ) DATA_FILE_NAME, the name of the data file. ! ! Input, integer LDA, the leading dimension of X. ! ! Input, integer NROW, NCOL, the dimensions of X. ! ! Input, real X(LDA,NCOL), the NROW by NCOL data to be written. ! ! Output, integer IERROR, nonzero if an error occurred. ! implicit none ! integer lda integer ncol ! character ( len = * ) data_file_name integer file_unit integer i integer ierror integer ios integer nrow real x(lda,ncol) ! ierror = 0 call get_unit ( file_unit ) if ( file_unit == 0 ) then ierror = 1 write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'WRITE_XYY_DATA - Fatal error!' write ( *, '(a)' ) ' Could not get a free FORTRAN unit.' return end if open ( unit = file_unit, file = data_file_name, status = 'replace', & iostat = ios ) if ( ios /= 0 ) then ierror = 2 write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'WRITE_XYY_DATA - Fatal error!' write ( *, '(a)' ) ' Could not open the output file.' return end if do i = 1, nrow write ( file_unit, * ) x(i,1:ncol) end do close ( unit = file_unit ) write ( *, '(a)' ) ' ' write ( *, '(a)' ) 'WRITE_XYY_DATA:' write ( *, '(a)' ) ' Wrote the GNUPLOT XYY data file "' // & trim ( data_file_name ) // '"' return endsubroutine write_xyy_data