Mercurial > octave
diff doc/interpreter/vectorize.txi @ 28487:a7fcdac012d8 stable
doc: Fix incorrect example code in Vectorize chapter (bug #58607).
* vectorize.txi: Define 'n = length (A) - 1;' to avoid overstepping index
bounds.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 17 Jun 2020 14:41:13 -0700 |
parents | e9a12be5fd79 |
children | f254c302bb9c |
line wrap: on
line diff
--- a/doc/interpreter/vectorize.txi Tue Jun 16 17:03:13 2020 -0400 +++ b/doc/interpreter/vectorize.txi Wed Jun 17 14:41:13 2020 -0700 @@ -693,9 +693,9 @@ @example @group -n = length (A); +n = length (A) - 1; B = zeros (n, 2); -for i = 1:length (A) +for i = 1:n ## this will be two columns, the first is the difference and ## the second the mean of the two elements used for the diff. B(i,:) = [A(i+1)-A(i), (A(i+1) + A(i))/2];