Fahed
28th April 2011, 13:24
Hi,
I have implemented simple qwt plot application and i have added pushbutton this application reads data from bin file and plots it.
Now when i start application it plots the data from file, now I want
"on button press(which will invoke comand based program and save new bin file in same diractory) to capture new data and put in the file and after that it shud refresh the plot with new file.
but some how its not working.
here is my code
int main(int argc, char **argv)
{
QApplication a(argc, argv);
Plot plot;
QPushButton FFT("FFT",&plot);
FFT.resize(75, 30);
FFT.setFont(QFont("Times", 18, QFont::Bold));
QObject::connect(&FFT, SIGNAL(clicked()), &Plot(), SLOT(replot()));
plot.resize(600,400);
plot.show();
return a.exec();
}
//////////////////
I want to run following code again when i press the pushbutton FFT
system("./readwritegpp readwrite.out 0xC4F5B000 16392 1");
FILE *fin;
float *ptr;
fin = fopen( "test.bin", "rb" ); //rb means read-binary
for (int count=0; count<4096 ; count++)
{
fread( &val[count], 1, 4, fin ); //size of float = 4 bytes
nPoints[count]=count;
fft_db[count]=val[count];
}
fclose(fin);
fft->setData(nPoints, fft_db, 4096);
can anyone help me?
I have implemented simple qwt plot application and i have added pushbutton this application reads data from bin file and plots it.
Now when i start application it plots the data from file, now I want
"on button press(which will invoke comand based program and save new bin file in same diractory) to capture new data and put in the file and after that it shud refresh the plot with new file.
but some how its not working.
here is my code
int main(int argc, char **argv)
{
QApplication a(argc, argv);
Plot plot;
QPushButton FFT("FFT",&plot);
FFT.resize(75, 30);
FFT.setFont(QFont("Times", 18, QFont::Bold));
QObject::connect(&FFT, SIGNAL(clicked()), &Plot(), SLOT(replot()));
plot.resize(600,400);
plot.show();
return a.exec();
}
//////////////////
I want to run following code again when i press the pushbutton FFT
system("./readwritegpp readwrite.out 0xC4F5B000 16392 1");
FILE *fin;
float *ptr;
fin = fopen( "test.bin", "rb" ); //rb means read-binary
for (int count=0; count<4096 ; count++)
{
fread( &val[count], 1, 4, fin ); //size of float = 4 bytes
nPoints[count]=count;
fft_db[count]=val[count];
}
fclose(fin);
fft->setData(nPoints, fft_db, 4096);
can anyone help me?