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

David Bateman David.Bateman at motorola.com
Wed Jan 9 04:01:15 CST 2008


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                                David.Bateman at motorola.com
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

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch7
Url: https://www.cae.wisc.edu/pipermail/help-octave/attachments/20080109/17ec4b20/attachment.ksh 


More information about the Help-octave mailing list