MCPcopy Create free account
hub / github.com/BatchDrake/SigDigger / saveToMatlab

Method saveToMatlab

Components/RMSViewTab.cpp:58–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56// https://stackoverflow.com/questions/12966957/is-there-an-equivalent-in-c-of-phps-explode-function
57
58bool
59RMSViewTab::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
88void
89RMSViewTab::integrateMeasure(qreal timestamp, SUFLOAT mag)

Callers 1

onSaveMethod · 0.95

Calls 2

valueMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected