Results 1 to 4 of 4

Thread: Saving two data sets to the same file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2016
    Posts
    3
    Qt products
    Qt3 Qt5
    Platforms
    Windows

    Default Saving two data sets to the same file

    Hello,
    I'm working on an open source code for the Intan RDH2000 interface software.
    I have two types of signals data - amplifier and auxiliary.
    The amplifier is saved in the qint16 format and the auxiliary in the uqint16 format.
    Moreover, the amplifier data is sampled every at each time step while the auxiliary data is sampled only at each 4th time step.
    I'm trying (and so far failing) to merge these two signals type so they will both be on the same file with the same qint16 format.
    About the time step, I don't mind to duplicate the auxiliary data so it will be identical for each 4 consecutive time steps.

    Here is the function I'm working on, I'm new to QT and a little rusty in C++ so I would appreciate any suggestion you might have:
    Qt Code:
    1. // Save amplifier data
    2. bufferIndex = 0;
    3. for (t = 0; t < SAMPLES_PER_DATA_BLOCK; ++t) {
    4. for (i = 0; i < saveListAmplifier.size(); ++i) {
    5. tempQint16 = (qint16)
    6. (dataQueue.front().amplifierData[saveListAmplifier.at(i)->boardStream][saveListAmplifier.at(i)->chipChannel][t] - 32768);
    7. dataStreamBuffer[bufferIndex++] = tempQint16 & 0x00ff; // Save qint16 in little-endian format (LSByte first)
    8. dataStreamBuffer[bufferIndex++] = (tempQint16 & 0xff00) >> 8; // (MSByte last)
    9. }
    10. }
    11. if (bufferIndex > 0) {
    12. amplifierStream->writeRawData(dataStreamBuffer, bufferIndex); // Stream out all data at once to speed writing
    13. numWordsWritten += saveListAmplifier.size() * SAMPLES_PER_DATA_BLOCK;
    14. }
    15.  
    16. // Save auxiliary input data
    17. bufferIndex = 0;
    18. for (t = 0; t < SAMPLES_PER_DATA_BLOCK; ++t) {
    19. tAux = 4 * qFloor((double) t / 4.0);
    20. for (i = 0; i < saveListAuxInput.size(); ++i) {
    21. tempQuint16 = (quint16)
    22. dataQueue.front().auxiliaryData[saveListAuxInput.at(i)->boardStream][1][tAux + saveListAuxInput.at(i)->chipChannel + 1];
    23. dataStreamBuffer[bufferIndex++] = tempQuint16 & 0x00ff; // Save quint16 in little-endian format (LSByte first)
    24. dataStreamBuffer[bufferIndex++] = (tempQuint16 & 0xff00) >> 8; // (MSByte last)
    25. }
    26. }
    27. if (bufferIndex > 0) {
    28. auxInputStream->writeRawData(dataStreamBuffer, bufferIndex); // Stream out all data at once to speed writing
    29. numWordsWritten += saveListAuxInput.size() * SAMPLES_PER_DATA_BLOCK;
    30. }
    To copy to clipboard, switch view to plain text mode 

    With thanks,
    Amir
    Last edited by anda_skoa; 31st August 2016 at 09:26. Reason: missing [code] tags

Similar Threads

  1. QTableView and Large data sets
    By KenJustKen in forum Qt Programming
    Replies: 3
    Last Post: 25th January 2016, 09:16
  2. Replies: 5
    Last Post: 2nd July 2012, 20:49
  3. Replies: 1
    Last Post: 22nd September 2010, 15:39
  4. Saving pure plot data to image file
    By Debilski in forum Qwt
    Replies: 4
    Last Post: 7th April 2009, 17:02
  5. Creating images from sets of data.
    By maverick_pol in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2008, 09:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.