Bug in stand-alone example program of section A.3 of the manual

John W. Eaton jwe at bevo.che.wisc.edu
Wed Jan 9 11:28:15 CST 2008


On  9-Jan-2008, David Bateman wrote:

| 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

I applied the patch and checked it in.

To the OP, and everyone else on the lists:  if you have a bug to
report, please use the bug at octave.org list.

Thanks,

jwe



More information about the Help-octave mailing list