Mercurial > hg > octave-nkf
annotate scripts/general/subsindex.m @ 20177:15e5eb7a0c1d
make dist: add updated zoom images to EXTRADIST (bug #44579)
* libgui/graphics/module.mk: add graphics/images/zoom-in.png, graphics/images/zoom-out.png, remove graphics/images/zoom.png
author | John Donoghue |
---|---|
date | Thu, 19 Mar 2015 08:37:47 -0400 |
parents | 4197fc428c7d |
children | 7503499a252b |
rev | line source |
---|---|
19898
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
1 ## Copyright (C) 2008-2015 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}) |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
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 |
17281
bc924baa2c4e
doc: Add new @qcode macro for code samples which are quoted.
Rik <rik@octave.org>
parents:
14868
diff
changeset
|
26 ## class @qcode{"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) |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
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) |
14327
4d917a6a858b
doc: Use Octave coding conventions in @example blocks of docstrings.
Rik <octave@nomad.inbox5.com>
parents:
14138
diff
changeset
|
42 ## idx = double (a.a) - 1.0; |
8154
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) |
14868
5d3a684236b0
maint: Use Octave coding conventions for cuddling parentheses in scripts directory
Rik <octave@nomad.inbox5.com>
parents:
14327
diff
changeset
|
63 error ("subsindex: not defined for class \"%s\"", class (a)); |
8154
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 |