Changeset 32 for tools


Ignore:
Timestamp:
04/03/09 13:07:12 (16 years ago)
Author:
ogrimm
Message:
Data transmission over socket contains now frequency and scale factor
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/ddd/Functions.cpp

    r29 r32  
    211211    double *y = new double [NumberOfEntries];
    212212
    213     while((NextNumber=strtok(NULL, " "))!=NULL && Count<NumberOfEntries) {      // All entries are separated by a whitespace
    214       *(y+Count) = atof(NextNumber);
    215       x[Count] = Count;
    216       Count++;
    217     }
     213    // Convert all entries (separated by a whitespace) to numbers
     214    while((NextNumber=strtok(NULL, " "))!=NULL && Count<NumberOfEntries)
     215      *(y+Count++) = atof(NextNumber);
    218216    if (Count==NumberOfEntries && NextNumber!=0)
    219217      QMessageBox::warning(this, "ddd Message","Found too many numbers in data block, truncated.",QMessageBox::Ok);
    220     Signal->setData(x, y, Count);       // Copies data, arrays can be deleted afterwards
    221     Signal->show();
    222     Zoomer->setZoomBase(Signal->boundingRect());
    223 
     218    // Apply sampling frequency and scaling factor
     219    for(int i=2; i<Count; i++) {
     220      x[i] = (i-2) / y[0];
     221      y[i] = y[i] * y[1];
     222    }
     223    if(NumberOfEntries>2) {
     224      Signal->setData(x+2, y+2, NumberOfEntries-2); // Copies data, arrays can be deleted afterwards
     225      Signal->show();
     226      Zoomer->setZoomBase(Signal->boundingRect());
     227    } 
    224228    delete[] x;   delete[] y;
    225229
Note: See TracChangeset for help on using the changeset viewer.