Bug in stand-alone example program of section A.3 of the manual
José Luis García Pallero
jgpallero at gmail.com
Wed Jan 9 03:00:54 CST 2008
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);
*****************************************
José Luis García Pallero
jgpallero at gmail.com
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.cae.wisc.edu/pipermail/help-octave/attachments/20080109/8a056dc6/attachment.html
More information about the Help-octave
mailing list