|
From: Ethan A M. <eam...@gm...> - 2013-04-27 03:55:03
|
On Friday, 26 April 2013, seb_kramm wrote:
> Hello,
>
> Currently, when chaining different plot commands in a script, it seems that gnuplot
> aborts when encountering a error (unreadable data file, in my case).
>
> Is there any way to tell gnuplot not to abort and to move on to the next 'plot'
> command ? I searched the manual but found nothing about error handling.
There is no general mechanism for continuing to execute a script after an error.
> I use 4.6 on Ubuntu.
>
> The situation is as follows: I have many plots to draw from many computer-generated
> data files. The script file is itself generated. Now, some data files are ill formed
> or non-existent, due to some experimental error (say, the program that generates the
> data crashes).
> But I would like to have the plots for all the other datafiles.
How about
expected_file = "filename"
stat = system("wc ".expected_file)
if (stat ne "") {
plot expected_file
}
If you want to test for a file that exists but is too short to
contain the expected data:
stat = system("wc ".expected_file)
if (stat ne "" && int(word(stat,1)) > min_size) {
plot expected_file
}
Ethan
--
Tradition is not the worship of ashes, but the preservation of fire.
- Gustav Mahler
|