]> Creatis software - CreaPhase.git/blob - octave_packages/m/plot/private/__errcomm__.m
update packages
[CreaPhase.git] / octave_packages / m / plot / private / __errcomm__.m
1 ## Copyright (C) 2001-2012 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 3 of the License, or (at
8 ## your option) 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, see
17 ## <http://www.gnu.org/licenses/>.
18
19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {} __errcomm__ (@var{caller}, @var{p}, @dots{})
21 ## Undocumented internal function.
22 ## @end deftypefn
23
24 ## Created: 20.02.2001
25 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
26 ## Keywords: errorbar, plotting
27
28 function retval = __errcomm__ (caller, p, varargin)
29
30   if (nargin < 4)
31     print_usage ();
32   endif
33
34   nargs = length (varargin);
35   retval = [];
36   k = 1;
37   data = cell(6,1);
38   while (k <= nargs)
39     a = varargin{k++};
40     if (isvector (a))
41       a = a(:);
42     elseif (ismatrix (a))
43       ;
44     else
45       usage ("%s (...)", caller);
46     endif
47     sz = size (a);
48     ndata = 1;
49     data{ndata} = a;
50     while (k <= nargs)
51       a = varargin{k++};
52       if (ischar (a) || iscellstr (a))
53         retval = [retval; __errplot__(a, p, data{1:ndata})];
54         break;
55       elseif (isvector (a))
56         a = a(:);
57       elseif (ismatrix (a))
58         ;
59       else
60         error ("wrong argument types");
61       endif
62       if (size (a) != sz)
63         error ("argument sizes do not match");
64       endif
65       data{++ndata} = a;
66       if (ndata > 6)
67         error ("too many arguments to a plot");
68       endif
69     endwhile
70   endwhile
71
72   if (! (ischar (a) || iscellstr (a)))
73     retval = [retval; __errplot__("~", p, data{1:ndata})];
74   endif
75
76   drawnow ();
77
78 endfunction