minor enhancement to sub2ind.m and ind2sub.m
Muthiah Annamalai
muthuspost at gmail.com
Thu Jan 3 14:19:46 CST 2008
minor enhancement to sub2ind.m and ind2sub.m to describe the formation
of the linear index generation.
-Muthu
Changelog entry
2008-1-3 Muthiah Annamalai <muthuspost at gmail.com>
general/ind2sub.m, general/sub2ind.m: add description of linear
index
Index: scripts/general/ind2sub.m
===================================================================
RCS file: /cvs/octave/scripts/general/ind2sub.m,v
retrieving revision 1.11
diff -u -p -r1.11 ind2sub.m
--- scripts/general/ind2sub.m 12 Oct 2007 21:27:21 -0000 1.11
+++ scripts/general/ind2sub.m 3 Jan 2008 19:00:48 -0000
@@ -21,8 +21,8 @@
## Convert a linear index into subscripts.
##
## The following example shows how to convert the linear index @code{8}
-## in a 3-by-3 matrix into a subscript.
-##
+## in a 3-by-3 matrix into a subscript. The matrix is lineary indexed
+## moving from one column to next, filling up all rows in each column.
## @example
## [r, c] = ind2sub ([3, 3], 8)
## @result{} r = 2
Index: scripts/general/sub2ind.m
===================================================================
RCS file: /cvs/octave/scripts/general/sub2ind.m,v
retrieving revision 1.11
diff -u -p -r1.11 sub2ind.m
--- scripts/general/sub2ind.m 12 Oct 2007 21:27:22 -0000 1.11
+++ scripts/general/sub2ind.m 3 Jan 2008 19:00:48 -0000
@@ -22,7 +22,9 @@
## Convert subscripts into a linear index.
##
## The following example shows how to convert the two-dimensional
-## index @code{(2,3)} of a 3-by-3 matrix to a linear index.
+## index @code{(2,3)} of a 3-by-3 matrix to a linear index.The matrix
+## is lineary indexed moving from one column to next, filling up
+## all rows in each column.
##
## @example
## linear_index = sub2ind ([3, 3], 2, 3)
More information about the Bug-octave
mailing list