Hi the board
Sorry if my english is not fluently ( im just French and im doing my best )
I'm really a newbie about C++ and QT just started it few days ago. Ive create a small progarm to get data from Arduino serial port, i got the data, i can parse the data as i wanted to do
And i even save the data into csv file
Now i have made some code to access a specific row in the file, it works i can display on textEdit, but i need to get a code to get maximum value of this specific row
I try many code but QT debug give me reply line by line and the function std::max_element cant works correctly.... i would like to get output in one line and then execute max_element
Ive been searching everyboard for hours, but i cant solved it alone
void Dialog::on_pushButton_clicked()
{
{
QString fichier2
= "c:/qt/essaiqt.csv";
return;
while (!file.atEnd())
{
QByteArrayList fields {line.split(';')};
fields[3] = fields [3].simplified();
column2 = column2.simplified();
column2.toDouble();
QVector<double> essai;
auto valeur = std::max_element(column2.begin(), column2.end());
std::cout << "max "<< valeur;
qDebug() << "x=" << column2;
{
ui->textEdit->append(fields[3]);
}
}
}
void Dialog::on_pushButton_clicked()
{
{
QString fichier2= "c:/qt/essaiqt.csv";
QFile file(fichier2);
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
return;
while (!file.atEnd())
{
QByteArray line = file.readLine();
QByteArrayList fields {line.split(';')};
QByteArray column2 {(fields [3])};
QDataStream s(column2);
fields[3] = fields [3].simplified();
column2 = column2.simplified();
column2.toDouble();
QVector<double> essai;
auto valeur = std::max_element(column2.begin(), column2.end());
std::cout << "max "<< valeur;
qDebug() << "x=" << column2;
{
ui->textEdit->append(fields[3]);
}
}
}
To copy to clipboard, switch view to plain text mode
and output looks like it output.png
Your help will be highly appreciate
Bookmarks