Mercurial > hg > octave-nkf
annotate scripts/plot/__gnuplot_open_stream__.m @ 10509:ddbd812d09aa
properly compress sparse matrices after assembly
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 12 Apr 2010 12:57:44 +0200 |
parents | c60a9e1a0372 |
children | 2c356a35d7f5 |
rev | line source |
---|---|
9113
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
1 ## Copyright (C) 2009 Ben Abbott |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
2 ## |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
3 ## This program is free software; you can redistribute it and/or modify |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
4 ## it under the terms of the GNU General Public License as published by |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
5 ## the Free Software Foundation; either version 2 of the License, or |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
6 ## (at your option) any later version. |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
7 ## |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
8 ## This program is distributed in the hope that it will be useful, |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
11 ## GNU General Public License for more details. |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
12 ## |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
13 ## You should have received a copy of the GNU General Public License |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
14 ## along with Octave; see the file COPYING. If not, see |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
15 ## <http://www.gnu.org/licenses/>. |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
16 |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
17 ## -*- texinfo -*- |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
18 ## @deftypefn {Function File} {@var{stream}} __gnuplot_open_stream__ (@var{npipes}, @var{h}) |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
19 ## Undocumented internal function. |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
20 ## @end deftypefn |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
21 |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
22 ## Author: Ben Abbott <bpabbott@mac.com> |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
23 ## Created: 2009-04-11 |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
24 |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
25 function plot_stream = __gnuplot_open_stream__ (npipes, h) |
9461
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
9113
diff
changeset
|
26 [prog, args] = gnuplot_binary (); |
9113
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
27 if (npipes > 1) |
9461
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
9113
diff
changeset
|
28 [plot_stream(1), plot_stream(2), pid] = popen2 (prog, args{:}); |
9113
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
29 if (pid < 0) |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
30 error ("__gnuplot_open_stream__: failed to open connection to gnuplot."); |
9561
c60a9e1a0372
try to avoid gnuplot zombies
John W. Eaton <jwe@octave.org>
parents:
9461
diff
changeset
|
31 else |
c60a9e1a0372
try to avoid gnuplot zombies
John W. Eaton <jwe@octave.org>
parents:
9461
diff
changeset
|
32 plot_stream(3) = pid; |
9113
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
33 endif |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
34 else |
9461
ff8d7f3ad203
gnuplot_binary.m: accept arguments in addition to program name
John W. Eaton <jwe@octave.org>
parents:
9113
diff
changeset
|
35 plot_stream = popen (sprintf ("%s ", prog, args{:}), "w"); |
9113
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
36 if (plot_stream < 0) |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
37 error ("__gnuplot_open_stream__: failed to open connection to gnuplot."); |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
38 endif |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
39 endif |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
40 if (nargin > 1) |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
41 set (h, "__plot_stream__", plot_stream); |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
42 endif |
4bb94a71913b
__gnuplot_open_stream__.m: New function and its application.
Ben Abbott <bpabbott@mac.com>
parents:
diff
changeset
|
43 endfunction |