annotate scripts/general/subsindex.m @ 14327:4d917a6a858b stable

doc: Use Octave coding conventions in @example blocks of docstrings. * accumarray.m, accumdim.m, bar.m, base2dec.m, bincoeff.m, bitcmp.m, bitset.m, celldisp.m, chop.m, clabel.m, cloglog.m, colon.m, compass.m, computer.m, contour3.m, contourc.m, corr.m, cstrcat.m, ctime.m, cylinder.m, date.m, dec2base.m, demo.m, dir.m, dlmwrite.m, expm.m, ezcontourf.m, ezcontour.m, ezmeshc.m, ezmesh.m, ezplot.m, ezsurfc.m, ezsurf.m, feather.m, findobj.m, flipdim.m, fplot.m, genvarname.m, getfield.m, hankel.m, hilb.m, hist.m, idivide.m, index.m, int2str.m, interp1.m, is_leap_year.m, ismember.m, isocolors.m, isonormals.m, isosurface.m, kurtosis.m, legendre.m, linkprop.m, logit.m, logm.m, __makeinfo__.m, __marching_cube__.m, median.m, mkoctfile.m, moment.m, mpoles.m, orderfields.m, pcg.m, pcr.m, plot3.m, plotmatrix.m, polyaffine.m, polygcd.m, poly.m, polyout.m, print.m, qp.m, quadgk.m, qzhess.m, randi.m, rat.m, refreshdata.m, residue.m, rose.m, rot90.m, saveas.m, saveobj.m, shiftdim.m, skewness.m, spaugment.m, spdiags.m, sqp.m, stem.m, str2num.m, strcat.m, strjust.m, strread.m, strsplit.m, structfun.m, subplot.m, subsindex.m, substruct.m, surfl.m, surfnorm.m, svds.m, uimenu.m, union.m, voronoi.m, warning_ids.m, wblpdf.m: Use Octave coding conventions in @example blocks of docstrings.
author Rik <octave@nomad.inbox5.com>
date Sat, 04 Feb 2012 22:12:50 -0800
parents 72c96de7a403
children 5d3a684236b0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14138
72c96de7a403 maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents: 11587
diff changeset
1 ## Copyright (C) 2008-2012 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
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)
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)
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