annotate scripts/general/subsindex.m @ 11264:79b77d71d01e

subsindex.m: Fix typo in doc-string.
author Ben Abbott <bpabbott@mac.com>
date Wed, 17 Nov 2010 20:17:10 -0500
parents 16f53d29049f
children fd0a3ac60b0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9245
16f53d29049f update copyright notices
John W. Eaton <jwe@octave.org>
parents: 9051
diff changeset
1 ## Copyright (C) 2008, 2009 David Bateman
8154
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
2 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
3 ## This file is part of Octave.
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
4 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 ## the Free Software Foundation; either version 3 of the License, or (at
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 ## your option) any later version.
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
9 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
13 ## General Public License for more details.
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, see
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
17 ## <http://www.gnu.org/licenses/>.
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
18
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
19 ## -*- texinfo -*-
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
20 ## @deftypefn {Function File} {@var{idx} =} subsindex (@var{a})
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8154
diff changeset
21 ## Convert an object to an index vector. When @var{a} is a class object
8154
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
22 ## defined with a class constructor, then @code{subsindex} is the
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
23 ## overloading method that allows the conversion of this class object to
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8154
diff changeset
24 ## a valid indexing vector. It is important to note that
8154
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
25 ## @code{subsindex} must return a zero-based real integer vector of the
9051
1bf0ce0930be Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents: 8154
diff changeset
26 ## class "double". For example, if the class constructor
8154
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
27 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
28 ## @example
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
29 ## @group
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
30 ## function b = myclass (a)
11264
79b77d71d01e subsindex.m: Fix typo in doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
31 ## b = class (struct ("a", a), "myclass");
8154
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
32 ## endfunction
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
33 ## @end group
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
34 ## @end example
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
35 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
36 ## @noindent
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
37 ## then the @code{subsindex} function
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
38 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
39 ## @example
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
40 ## @group
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
41 ## function idx = subsindex (a)
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
42 ## idx = double (a.a) - 1.0;
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
43 ## endfunction
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
44 ## @end group
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
45 ## @end example
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
46 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
47 ## @noindent
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
48 ## can then be used as follows
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
49 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
50 ## @example
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
51 ## @group
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
52 ## a = myclass (1:4);
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
53 ## b = 1:10;
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
54 ## b(a)
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
55 ## @result{} 1 2 3 4
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
56 ## @end group
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
57 ## @end example
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
58 ##
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
59 ## @seealso{class, subsref, subsasgn}
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
60 ## @end deftypefn
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
61
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
62 function idx = subsindex (a)
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
63 error ("subsindex: not defined for class \"%s\"", class(a));
265a821f6555 Add subsindex and ismethod functions
David Bateman <dbateman@free.fr>
parents:
diff changeset
64 endfunction
11264
79b77d71d01e subsindex.m: Fix typo in doc-string.
Ben Abbott <bpabbott@mac.com>
parents: 9245
diff changeset
65