Mercurial > hg > octave-lyh
annotate scripts/plot/__gnuplot_version__.m @ 8101:86955a1559c5
improve speed of cell2mat
* * *
trivial fix for previous cell2mat change
author | David Bateman <dbateman@free.fr> |
---|---|
date | Thu, 11 Sep 2008 16:57:12 -0400 |
parents | 9c15f385811c |
children | 7d6e659acc1a 7cc783e52ddb |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 2006, 2007 Daniel Sebald |
6087 | 2 ## |
6440 | 3 ## This file is part of Octave. |
4 ## | |
6087 | 5 ## Octave is free software; you can redistribute it and/or modify it |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6087 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6087 | 18 |
6895 | 19 ## Undocumented internal function. |
20 | |
6087 | 21 ## Return the version of gnuplot we are using. Note that we do not |
22 ## attempt to handle the case of the user switching to different | |
23 ## versions of gnuplot during the same session. | |
24 | |
25 function version = __gnuplot_version__ () | |
26 | |
27 persistent __version__ = ""; | |
28 | |
29 if (isempty (__version__)) | |
30 [status, output] = system (sprintf ("%s --version", gnuplot_binary ())); | |
7714
83ea845cda36
Display a (hopefully) informative error message if gnuplot isn't found
sh@sh-laptop
parents:
7017
diff
changeset
|
31 if (status != 0) |
7716
9c15f385811c
__gnuplot_version__: use newline at end of message
John W. Eaton <jwe@octave.org>
parents:
7714
diff
changeset
|
32 ## This message ends in a newline so that the traceback messages |
9c15f385811c
__gnuplot_version__: use newline at end of message
John W. Eaton <jwe@octave.org>
parents:
7714
diff
changeset
|
33 ## are skipped and people might actually see the message, read it, |
9c15f385811c
__gnuplot_version__: use newline at end of message
John W. Eaton <jwe@octave.org>
parents:
7714
diff
changeset
|
34 ## comprehend it, actually take the advice it gives, and stop |
9c15f385811c
__gnuplot_version__: use newline at end of message
John W. Eaton <jwe@octave.org>
parents:
7714
diff
changeset
|
35 ## asking us why plotting fails when gnuplot is not found. |
9c15f385811c
__gnuplot_version__: use newline at end of message
John W. Eaton <jwe@octave.org>
parents:
7714
diff
changeset
|
36 error ("you must have gnuplot installed to display graphics; if you have gnuplot installed in a non-standard location, see the 'gnuplot_binary' function\n"); |
7714
83ea845cda36
Display a (hopefully) informative error message if gnuplot isn't found
sh@sh-laptop
parents:
7017
diff
changeset
|
37 endif |
6087 | 38 pattern = "^[^\\s]*\\s*([0-9]+\\.[0-9]+)\\s*[^\\s]*\\s*([^\\s]*)"; |
39 [d1, d2, d3, d4, matches] = regexp (output, pattern); | |
40 if (iscell (matches) && numel (matches) > 0 && iscellstr (matches{1})) | |
41 __version__ = matches{1}{1}; | |
42 endif | |
43 endif | |
44 | |
45 version = __version__; | |
46 | |
47 endfunction | |
48 |