TTable2D aNewTable2D;
aTable2D.getColumns(aNewTable2D);
int kEnd = aNewTable2D.myRows[0].myValues.size();
- aTableOfReal->SetNbColumns(kEnd);
+ // check empty columns
+ TColStd_MapOfInteger EmptyColumns;
for(int j = 0, jEnd = aNewTable2D.myRows.size(); j < jEnd; j++) {
+ bool hasVal = false;
+ for(int k = 0; k < kEnd; k++) {
+ QString aVal = aNewTable2D.myRows[j].myValues[k].c_str();
+ bool anIsOk = false;
+ double aValue = aVal.toDouble(&anIsOk);
+ if(anIsOk) {
+ hasVal = true;
+ break;
+ }
+ }
+ if(!hasVal) {
+ EmptyColumns.Add(j);
+ }
+ }
+ // create table of real
+ aTableOfReal->SetNbColumns( kEnd - EmptyColumns.Extent() );
+ int currNum = -1;
+ for(int j = 0, jEnd = aNewTable2D.myRows.size(); j < jEnd; j++) {
+ if( EmptyColumns.Contains(j) ) continue;
+ currNum++;
if(MYDEBUG) MESSAGE("j = "<<j<<"; kEnd = "<<kEnd);
-
for(int k = 0; k < kEnd; k++) {
QString aVal = aNewTable2D.myRows[j].myValues[k].c_str();
bool anIsOk = false;
double aValue = aVal.toDouble(&anIsOk);
- if(anIsOk && !aVal.contains("NAN",Qt::CaseInsensitive) && !aVal.contains("INF",Qt::CaseInsensitive))
- aTableOfReal->PutValue(aValue,j+1,k+1);
+ if( anIsOk && !aVal.contains("NAN",Qt::CaseInsensitive) &&
+ !aVal.contains("INF",Qt::CaseInsensitive) ) {
+ aTableOfReal->PutValue(aValue,currNum+1,k+1);
+ }
}
-
- aTableOfReal->SetRowTitle(j+1,aNewTable2D.myRows[j].myTitle.c_str());
- aTableOfReal->SetRowUnit(j+1,aNewTable2D.myRows[j].myUnit.c_str());
+ aTableOfReal->SetRowTitle(currNum+1,aNewTable2D.myRows[j].myTitle.c_str());
+ aTableOfReal->SetRowUnit(currNum+1,aNewTable2D.myRows[j].myUnit.c_str());
}
for(int k = 0; k < kEnd; k++)
aTableOfReal->SetColumnTitle(k+1,aNewTable2D.myColumnTitles[k].c_str());