set datafile separator ","
Saturday, November 22, 2008
Plot CSV data files in Gnuplot
To plot a data file that contains data separated with "," use the following at the gnuplot command prompt:
Octave mode in EMACS
To turn on Octave mode in EMACS use this:
It can be done automatically also ... that is for later !
M-x octave-mode
It can be done automatically also ... that is for later !
Saturday, November 1, 2008
Dynamic allocation of a 3d array
#include
using namespace std;
int main()
{
// tensor[numTables][numRows][numCols]
const size_t numTables = 2 ;
const size_t numRows = 3 ;
const size_t numCols = 4 ;
double*** tensor ;
tensor = new double** [numTables];
for(size_t table = 0 ; table < numTables ; ++table)
{
tensor[table] = new double* [numRows];
for(size_t row = 0 ; row < numRows ; ++row)
{
tensor[table][row] = new double [numCols];
}
}
unsigned int count = 1 ;
for(size_t table = 0 ; table < numTables ; ++table)
{
for(size_t row = 0 ; row < numRows ; ++row)
{
for(size_t col = 0 ; col < numCols ; ++col)
{
tensor[table][row][col] = count++;
}
}
}
for(size_t table = 0 ; table < numTables ; ++table)
{
for(size_t row = 0 ; row < numRows ; ++row)
{
for(size_t col = 0 ; col < numCols ; ++col)
{
cout << tensor[table][row][col] << " " ;
}
cout << endl ;
}
cout << endl ;
}
delete [] tensor ;
return 0 ;
}
Subscribe to:
Posts (Atom)