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 |
6302
|
31 function retval = __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; |
6302
|
40 idx = 1; |
6257
|
41 data = cell(6,1); |
|
42 while (k <= nargs) |
|
43 a = varargin{k++}; |
|
44 if (isvector (a)) |
|
45 a = a(:); |
|
46 elseif (ismatrix (a)) |
|
47 ; |
|
48 else |
|
49 usage ("%s (...)", caller); |
4019
|
50 endif |
6257
|
51 sz = size (a); |
|
52 ndata = 1; |
|
53 data{ndata} = a; |
4897
|
54 while (k <= nargs) |
4019
|
55 a = varargin{k++}; |
6257
|
56 if (ischar (a) || iscellstr (a)) |
6302
|
57 retval(idx++) = __errplot__ (a, h, data{1:ndata}); |
6257
|
58 break; |
|
59 elseif (isvector (a)) |
|
60 a = a(:); |
4030
|
61 elseif (ismatrix (a)) |
6257
|
62 ; |
4019
|
63 else |
6257
|
64 error ("wrong argument types"); |
|
65 endif |
|
66 if (size (a) != sz) |
|
67 error ("argument sizes do not match"); |
4019
|
68 endif |
6257
|
69 data{++ndata} = a; |
|
70 if (ndata > 6) |
|
71 error ("too many arguments to a plot"); |
|
72 endif |
4019
|
73 endwhile |
6257
|
74 endwhile |
4019
|
75 |
6257
|
76 if (! (ischar (a) || iscellstr (a))) |
6302
|
77 retval(idx++) = __errplot__ ("~", h, data{1:ndata}); |
6257
|
78 endif |
|
79 |
|
80 drawnow (); |
4019
|
81 |
|
82 endfunction |