Credits Overview Plotting Styles Commands Terminals

test for existence of a file

Trying to plot a nonexistent or unreadable file will generate an error that halts the progress of a script or iteration. The stats command can be used to avoid this as in the example below

     do for [i=first:last] {
         filename = sprintf("file%02d.dat", i)
         stats filename nooutput
         if (GPVAL_ERRNO) {
             print GPVAL_ERRMSG
             continue
         }
         plot filename title filename
     }