904
|
1 # Copyright (C) 1993, 1994 John W. Eaton |
245
|
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 the |
|
7 # Free Software Foundation; either version 2, or (at your option) any |
|
8 # later version. |
|
9 # |
|
10 # Octave is distributed in the hope that it will be useful, but WITHOUT |
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 # 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, 675 Mass Ave, Cambridge, MA 02139, USA. |
|
18 |
934
|
19 function plot_2_v_m (x, y, fmt) |
4
|
20 |
934
|
21 if (nargin < 2 || nargin > 3) |
|
22 msg = sprintf ("plot_2_v_m (x, y)\n"); |
|
23 msg = sprintf ("%s plot_2_v_m (x, y, fmt)", msg); |
|
24 usage (msg); |
|
25 elseif (nargin == 2) |
|
26 fmt = ""; |
4
|
27 endif |
|
28 |
|
29 [x_nr, x_nc] = size (x); |
|
30 [y_nr, y_nc] = size (y); |
|
31 |
|
32 if (x_nr == 1) |
|
33 x = x'; |
|
34 tmp = x_nr; |
|
35 x_nr = x_nc; |
|
36 x_nc = tmp; |
|
37 endif |
|
38 |
|
39 if (x_nr == y_nr) |
|
40 1; |
|
41 elseif (x_nr == y_nc) |
|
42 y = y'; |
|
43 tmp = y_nr; |
|
44 y_nr = y_nc; |
|
45 y_nc = tmp; |
|
46 else |
|
47 error ("plot_2_v_m: matrix dimensions must match"); |
|
48 endif |
|
49 |
|
50 if (y_nc > 0) |
|
51 tmp = [x, y]; |
934
|
52 cmd = sprintf ("gplot tmp(:,%d:%d:%d) %s", 1, x_nc, x_nc+1, fmt); |
4
|
53 for i = 2:y_nc |
934
|
54 cmd = sprintf ("%s, tmp(:,%d:%d:%d) %s", cmd, 1, i, i+1, fmt); |
4
|
55 endfor |
934
|
56 eval (cmd); |
4
|
57 else |
|
58 error ("plot_2_v_m: arguments must be a matrices"); |
|
59 endif |
|
60 |
|
61 endfunction |