| 56 | // https://stackoverflow.com/questions/12966957/is-there-an-equivalent-in-c-of-phps-explode-function |
| 57 | |
| 58 | bool |
| 59 | RMSViewTab::saveToMatlab(QString const &path) |
| 60 | { |
| 61 | FILE *fp; |
| 62 | |
| 63 | if ((fp = fopen(path.toStdString().c_str(), "w")) == nullptr) { |
| 64 | QMessageBox::critical( |
| 65 | this, |
| 66 | "Save data to MATLAB file", |
| 67 | "Failed to save data to MATLAB file: " |
| 68 | + QString(strerror(errno))); |
| 69 | return false; |
| 70 | } |
| 71 | |
| 72 | fprintf(fp, "RATE=%.9f;\n", this->rate / this->ui->intSpin->value()); |
| 73 | fprintf(fp, "TIMESTAMP=%.6f;\n", this->first); |
| 74 | fprintf(fp, "X=[\n"); |
| 75 | for (size_t i = 0; i < this->data.size(); ++i) |
| 76 | fprintf( |
| 77 | fp, |
| 78 | " %.9e, %.9f\n", |
| 79 | SU_C_REAL(this->data[i]), |
| 80 | SU_C_IMAG(this->data[i])); |
| 81 | |
| 82 | fprintf(fp, "];\n"); |
| 83 | fclose(fp); |
| 84 | |
| 85 | return true; |
| 86 | } |
| 87 | |
| 88 | void |
| 89 | RMSViewTab::integrateMeasure(qreal timestamp, SUFLOAT mag) |