[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in stand-alone example program of section A.3 of the manual
From: |
José Luis García Pallero |
Subject: |
Bug in stand-alone example program of section A.3 of the manual |
Date: |
Wed, 9 Jan 2008 10:00:54 +0100 |
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
address@hidden
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************
- Bug in stand-alone example program of section A.3 of the manual,
José Luis García Pallero <=