[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in stand-alone example program of section A.3 of the manual
From: |
David Bateman |
Subject: |
Re: Bug in stand-alone example program of section A.3 of the manual |
Date: |
Wed, 09 Jan 2008 11:01:15 +0100 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
José Luis García Pallero wrote:
> Hi,
>
> The code:
>
> #include <iostream>
> #include <octave/oct.h>
> int
> main (void)
> {
> std::cout << "Hello Octave world!\n";
>
> int n = 2;
> Matrix a_matrix = Matrix (n, n);
> for (octave_idx_type i = 0; i < n; i++)
> {
> for (octave_idx_type j = 0; j < n; j++)
> {
> a_matrix(row,column) = (i+1)*10 + (j+1);
>
> }
> }
> std::cout << a_matrix;
> return 0;
> }
> Has a bug in a_matrix(row,column) = (i+1)*10 + (j+1); because the
> variables row and column aren't defined. The correct form is:
> a_matrix(i,j) = (i+1)*10 + (j+1);
Opps... This was a cut and paste from "Coda" and I didn't check it that
carefully. Patch attached
D.
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
*** ./doc/interpreter/dynamic.txi.orig7 2007-11-06 21:26:18.000000000 +0100
--- ./doc/interpreter/dynamic.txi 2008-01-09 10:59:30.759655146 +0100
***************
*** 1635,1641 ****
@{
for (octave_idx_type j = 0; j < n; j++)
@{
! a_matrix(row,column) = (i+1)*10 + (j+1);
@}
@}
std::cout << a_matrix;
--- 1635,1641 ----
@{
for (octave_idx_type j = 0; j < n; j++)
@{
! a_matrix (i, j) = (i + 1) * 10 + (j + 1);
@}
@}
std::cout << a_matrix;