-
displaying data
how can i display Cluster1[0][n]in .dat file?Below is my code..
Code:
...
for(int j=0;j<DataHeight;j++)
{
for(int i=0;i<DataWidth;i++)
{
Data[i][j]=(unsigned char)(((float)dataconv[j][i]-min)/(max-min)*255);
if (Data[i][j]==170)
{
Cluster1[0][n]=Data[i][j];
n++;
}
}
}
-
continue...
i'm using C++ Builder version 5.0
-
Code:
#include <fstream>
...
std :: ofstream save("save.dat");
save << Cluster1[0][n];
save.close();
...
Like that, you mean?
- SirCrono6
-
yup..and do i have to add something before/after the code?i'm just a beginner in this programming area..
-
do you want to save just that one array element, or the whole array (of arrays)?
to save every element in the arrays:
Code:
#include <fstream>
...
int main() {
...
std :: ofstream save("ofile.dat");
for(int x=0;x<MAX_X;x--) //you define MAX_X somewhere else
{
for(int y=0;y<MAX_Y;y--) //you define MAX_Y somewhere else
ofile << Cluster1[x][y];
}
ofile.close();
...
} //end of main()
...