Mercurial > hg > octave-lyh
diff src/ov.cc @ 6631:1b8daf8c0397
[project @ 2007-05-16 16:11:55 by jwe]
author | jwe |
---|---|
date | Wed, 16 May 2007 16:11:56 +0000 |
parents | 1b7a6061a05d |
children | ed74670db09b |
line wrap: on
line diff
--- a/src/ov.cc +++ b/src/ov.cc @@ -1951,6 +1951,25 @@ are @samp{\"()\"}, @samp{\"@{@}\"}, and @samp{\".\"}.\n\ The @samp{subs} field may be either @samp{\":\"} or a cell array\n\ of index values.\n\ +\n\ +The following example shows how to extract the two first columns of\n\ +a matrix\n\ +\n\ +@example\n\ +val = magic(3)\n\ + @result{} val = [ 8 1 6\n\ + 3 5 7\n\ + 4 9 2 ]\n\ +idx.type = \"()\";\n\ +idx.subs = @{\":\", 1:2@};\n\ +subsref(val, idx)\n\ + @result{} [ 8 1 \n\ + 3 5 \n\ + 4 9 ]\n\ +@end example\n\ +\n\ +@noindent\n\ +Note that this is the same as writing @code{val(:,1:2)}.\n\ @seealso{subsasgn, substruct}\n\ @end deftypefn") { @@ -1983,6 +2002,21 @@ are @samp{\"()\"}, @samp{\"@{@}\"}, and @samp{\".\"}.\n\ The @samp{subs} field may be either @samp{\":\"} or a cell array\n\ of index values.\n\ +\n\ +The following example shows how to set the two first columns of a\n\ +3-by-3 matrix to zero.\n\ +\n\ +@example\n\ +val = magic(3);\n\ +idx.type = \"()\";\n\ +idx.subs = @{\":\", 1:2@};\n\ +subsasgn (val, idx, 0)\n\ + @result{} [ 0 0 6\n\ + 0 0 7\n\ + 0 0 2 ]\n\ +@end example\n\ +\n\ +Note that this is the same as writing @code{val(:,1:2) = 0}.\n\ @seealso{subsref, substruct}\n\ @end deftypefn") {