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 |
|
17 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA |
|
18 ## 02111-1307, 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 |
5115
|
26 function [data, fmtstr] = __plt2__ (x1, x2, fmt) |
933
|
27 |
5115
|
28 if (nargin < 2 || nargin > 3 || nargout != 2) |
|
29 usage ("[data, fmtstr] = __plt2__ (x1, x2, fmt)"); |
933
|
30 endif |
|
31 |
|
32 if (nargin == 2) |
|
33 fmt = ""; |
|
34 endif |
|
35 |
|
36 if (! isstr (fmt)) |
2315
|
37 error ("__plt2__: fmt must be a string"); |
933
|
38 endif |
|
39 |
|
40 if (any (any (imag (x1)))) |
|
41 x1 = real (x1); |
|
42 endif |
5115
|
43 |
933
|
44 if (any (any (imag (x2)))) |
|
45 x2 = real (x2); |
|
46 endif |
5115
|
47 |
4030
|
48 if (isscalar (x1)) |
|
49 if (isscalar (x2)) |
5115
|
50 [data, fmtstr] = __plt2ss__ (x1, x2, fmt); |
|
51 else |
|
52 error ("__plt2__: invalid data for plotting"); |
933
|
53 endif |
4030
|
54 elseif (isvector (x1)) |
|
55 if (isvector (x2)) |
5115
|
56 [data, fmtstr] = __plt2vv__ (x1, x2, fmt); |
4030
|
57 elseif (ismatrix (x2)) |
5115
|
58 [data, fmtstr] = __plt2vm__ (x1, x2, fmt); |
|
59 else |
|
60 error ("__plt2__: invalid data for plotting"); |
933
|
61 endif |
4030
|
62 elseif (ismatrix (x1)) |
|
63 if (isvector (x2)) |
5115
|
64 [data, fmtstr] = __plt2mv__ (x1, x2, fmt); |
4030
|
65 elseif (ismatrix (x2)) |
5115
|
66 [data, fmtstr] = __plt2mm__ (x1, x2, fmt); |
|
67 else |
|
68 error ("__plt2__: invalid data for plotting"); |
933
|
69 endif |
5115
|
70 else |
|
71 error ("__plt2__: invalid data for plotting"); |
933
|
72 endif |
|
73 |
|
74 endfunction |