annotate scripts/plot/__errcomm__.m @ 7017:a1dbe9d80eee

[project @ 2007-10-12 21:27:11 by jwe]
author jwe
date Fri, 12 Oct 2007 21:27:37 +0000
parents 93c65f2a5668
children 7d48766c21a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7017
a1dbe9d80eee [project @ 2007-10-12 21:27:11 by jwe]
jwe
parents: 7016
diff changeset
1 ## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 Teemu Ikonen
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
2 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
4 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
8 ## your option) any later version.
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
9 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
14 ##
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
7016
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
93c65f2a5668 [project @ 2007-10-12 06:40:56 by jwe]
jwe
parents: 6895
diff changeset
17 ## <http://www.gnu.org/licenses/>.
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
18
6895
76e3d985ae56 [project @ 2007-09-13 18:22:38 by jwe]
jwe
parents: 6404
diff changeset
19 ## Undocumented internal function.
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
20
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
21 ## Created: 20.02.2001
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
22 ## Author: Teemu Ikonen <tpikonen@pcu.helsinki.fi>
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
23 ## Keywords: errorbar, plotting
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
24
6404
2005c0169e36 [project @ 2007-03-14 14:42:47 by jwe]
jwe
parents: 6302
diff changeset
25 function retval = __errcomm__ (caller, p, varargin)
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
26
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
27 if (nargin < 4)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
28 print_usage ();
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
29 endif
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
30
4897
89eee52fd4c7 [project @ 2004-06-03 23:07:55 by jwe]
jwe
parents: 4772
diff changeset
31 nargs = length (varargin);
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
32
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
33 k = 1;
6302
a5cd8b77e892 [project @ 2007-02-13 08:08:33 by jwe]
jwe
parents: 6257
diff changeset
34 idx = 1;
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
35 data = cell(6,1);
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
36 while (k <= nargs)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
37 a = varargin{k++};
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
38 if (isvector (a))
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
39 a = a(:);
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
40 elseif (ismatrix (a))
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
41 ;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
42 else
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
43 usage ("%s (...)", caller);
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
44 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
45 sz = size (a);
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
46 ndata = 1;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
47 data{ndata} = a;
4897
89eee52fd4c7 [project @ 2004-06-03 23:07:55 by jwe]
jwe
parents: 4772
diff changeset
48 while (k <= nargs)
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
49 a = varargin{k++};
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
50 if (ischar (a) || iscellstr (a))
6404
2005c0169e36 [project @ 2007-03-14 14:42:47 by jwe]
jwe
parents: 6302
diff changeset
51 retval(idx++) = __errplot__ (a, p, data{1:ndata});
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
52 break;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
53 elseif (isvector (a))
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
54 a = a(:);
4030
22bd65326ec1 [project @ 2002-08-09 18:58:13 by jwe]
jwe
parents: 4020
diff changeset
55 elseif (ismatrix (a))
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
56 ;
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
57 else
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
58 error ("wrong argument types");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
59 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
60 if (size (a) != sz)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
61 error ("argument sizes do not match");
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
62 endif
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
63 data{++ndata} = a;
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
64 if (ndata > 6)
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
65 error ("too many arguments to a plot");
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
66 endif
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
67 endwhile
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
68 endwhile
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
69
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
70 if (! (ischar (a) || iscellstr (a)))
6404
2005c0169e36 [project @ 2007-03-14 14:42:47 by jwe]
jwe
parents: 6302
diff changeset
71 retval(idx++) = __errplot__ ("~", p, data{1:ndata});
6257
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
72 endif
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
73
44c91c5dfe1d [project @ 2007-01-30 19:16:52 by jwe]
jwe
parents: 6146
diff changeset
74 drawnow ();
4019
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
75
c6d7ae9fcdb9 [project @ 2002-08-05 16:42:36 by jwe]
jwe
parents:
diff changeset
76 endfunction