2847
|
1 ## Copyright (C) 1996, 1997 John W. Eaton |
2313
|
2 ## |
|
3 ## This file is part of Octave. |
|
4 ## |
|
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 |
|
7 ## the Free Software Foundation; either version 2, or (at your option) |
|
8 ## any later version. |
|
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 |
|
16 ## along with Octave; see the file COPYING. If not, write to the Free |
5307
|
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
18 ## 02110-1301, USA. |
933
|
19 |
3449
|
20 ## -*- texinfo -*- |
5115
|
21 ## @deftypefn {Function File} {[data, fmtstr] =} __plt2__ (@var{x1}, @var{x2}, @var{fmt}) |
3449
|
22 ## @end deftypefn |
3402
|
23 |
2314
|
24 ## Author: jwe |
|
25 |
6146
|
26 function [data, fmtstr, key] = __plt2__ (x1, x2, fmt, keystr) |
933
|
27 |
6146
|
28 if (nargin < 2 || nargin > 4 || nargout < 2 || nargout > 3) |
6046
|
29 print_usage (); |
933
|
30 endif |
|
31 |
6146
|
32 if (nargin < 3) |
|
33 fmt = {""}; |
933
|
34 endif |
|
35 |
6146
|
36 if (nargin < 4) |
|
37 keystr = {""}; |
|
38 endif |
|
39 |
|
40 if (! iscellstr (fmt)) |
|
41 error ("__plt1__: fmt must be a cell array of character strings"); |
|
42 endif |
|
43 |
|
44 if (! iscell (keystr)) |
|
45 error ("__plt1__: fmt must be a cell array"); |
933
|
46 endif |
|
47 |
|
48 if (any (any (imag (x1)))) |
|
49 x1 = real (x1); |
|
50 endif |
5115
|
51 |
933
|
52 if (any (any (imag (x2)))) |
|
53 x2 = real (x2); |
|
54 endif |
5115
|
55 |
4030
|
56 if (isscalar (x1)) |
|
57 if (isscalar (x2)) |
6146
|
58 [data, fmtstr, key] = __plt2ss__ (x1, x2, fmt, keystr); |
5115
|
59 else |
|
60 error ("__plt2__: invalid data for plotting"); |
933
|
61 endif |
4030
|
62 elseif (isvector (x1)) |
|
63 if (isvector (x2)) |
6146
|
64 [data, fmtstr, key] = __plt2vv__ (x1, x2, fmt, keystr); |
4030
|
65 elseif (ismatrix (x2)) |
6146
|
66 [data, fmtstr, key] = __plt2vm__ (x1, x2, fmt, keystr); |
5115
|
67 else |
|
68 error ("__plt2__: invalid data for plotting"); |
933
|
69 endif |
4030
|
70 elseif (ismatrix (x1)) |
|
71 if (isvector (x2)) |
6146
|
72 [data, fmtstr, key] = __plt2mv__ (x1, x2, fmt, keystr); |
4030
|
73 elseif (ismatrix (x2)) |
6146
|
74 [data, fmtstr, key] = __plt2mm__ (x1, x2, fmt, keystr); |
5115
|
75 else |
|
76 error ("__plt2__: invalid data for plotting"); |
933
|
77 endif |
5741
|
78 elseif (isempty (x1) && isempty (x2)) |
6146
|
79 data = {}; |
|
80 fmtstr = {}; |
|
81 key = {}; |
5115
|
82 else |
|
83 error ("__plt2__: invalid data for plotting"); |
933
|
84 endif |
|
85 |
|
86 endfunction |