comparison scripts/plot/__gnuplot_version__.m @ 11753:5cedea7a0fdd release-3-0-x

Display a (hopefully) informative error message if gnuplot isn't found
author sh@sh-laptop
date Wed, 16 Apr 2008 14:19:59 -0400
parents a1dbe9d80eee
children 9c15f385811c
comparison
equal deleted inserted replaced
11752:ee21531f1b5e 11753:5cedea7a0fdd
26 26
27 persistent __version__ = ""; 27 persistent __version__ = "";
28 28
29 if (isempty (__version__)) 29 if (isempty (__version__))
30 [status, output] = system (sprintf ("%s --version", gnuplot_binary ())); 30 [status, output] = system (sprintf ("%s --version", gnuplot_binary ()));
31 if (status != 0)
32 error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function");
33 endif
31 pattern = "^[^\\s]*\\s*([0-9]+\\.[0-9]+)\\s*[^\\s]*\\s*([^\\s]*)"; 34 pattern = "^[^\\s]*\\s*([0-9]+\\.[0-9]+)\\s*[^\\s]*\\s*([^\\s]*)";
32 [d1, d2, d3, d4, matches] = regexp (output, pattern); 35 [d1, d2, d3, d4, matches] = regexp (output, pattern);
33 if (iscell (matches) && numel (matches) > 0 && iscellstr (matches{1})) 36 if (iscell (matches) && numel (matches) > 0 && iscellstr (matches{1}))
34 __version__ = matches{1}{1}; 37 __version__ = matches{1}{1};
35 endif 38 endif