4019
|
1 ## Copyright (C) 2001, 2002 Teemu Ikonen |
|
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. |
4019
|
19 |
|
20 ## -*- texinfo -*- |
|
21 ## @deftypefn {Function File} {} __errcomm__ (@var{args}) |
|
22 ## Common argument handling code for all error plots (errorbar, loglogerr, |
|
23 ## semilogyerr, semilogxerr). |
5642
|
24 ## @seealso{errorbar, semilogxerr, semilogyerr, loglogerr, __pltopt__} |
4019
|
25 ## @end deftypefn |
|
26 |
|
27 ## Created: 20.02.2001 |
|
28 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi> |
|
29 ## Keywords: errorbar, plotting |
|
30 |
6257
|
31 function __errcomm__ (caller, h, varargin) |
4019
|
32 |
6257
|
33 if (nargin < 4) |
|
34 print_usage (); |
4019
|
35 endif |
|
36 |
4897
|
37 nargs = length (varargin); |
6257
|
38 |
|
39 k = 1; |
|
40 data = cell(6,1); |
|
41 while (k <= nargs) |
|
42 a = varargin{k++}; |
|
43 if (isvector (a)) |
|
44 a = a(:); |
|
45 elseif (ismatrix (a)) |
|
46 ; |
|
47 else |
|
48 usage ("%s (...)", caller); |
4019
|
49 endif |
6257
|
50 sz = size (a); |
|
51 ndata = 1; |
|
52 data{ndata} = a; |
4897
|
53 while (k <= nargs) |
4019
|
54 a = varargin{k++}; |
6257
|
55 if (ischar (a) || iscellstr (a)) |
|
56 __errplot__ (a, h, data{1:ndata}); |
|
57 break; |
|
58 elseif (isvector (a)) |
|
59 a = a(:); |
4030
|
60 elseif (ismatrix (a)) |
6257
|
61 ; |
4019
|
62 else |
6257
|
63 error ("wrong argument types"); |
|
64 endif |
|
65 if (size (a) != sz) |
|
66 error ("argument sizes do not match"); |
4019
|
67 endif |
6257
|
68 data{++ndata} = a; |
|
69 if (ndata > 6) |
|
70 error ("too many arguments to a plot"); |
|
71 endif |
4019
|
72 endwhile |
6257
|
73 endwhile |
4019
|
74 |
6257
|
75 if (! (ischar (a) || iscellstr (a))) |
|
76 __errplot__ ("~", h, data{1:ndata}); |
|
77 endif |
|
78 |
|
79 drawnow (); |
4019
|
80 |
|
81 endfunction |