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

Method openMat5

Tasks/ExportSamplesTask.cpp:185–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183}
184
185bool
186ExportSamplesTask::openMat5(void)
187{
188 su_mat_matrix_t *mtx = nullptr;
189 bool ok = false;
190
191 SU_TRYCATCH(this->mf = su_mat_file_new(), goto done);
192
193 SU_TRYCATCH(
194 mtx = su_mat_file_make_matrix(this->mf, "sampleRate", 1, 1),
195 goto done);
196 SU_TRYCATCH(su_mat_matrix_write_col(mtx, fs), goto done);
197
198 SU_TRYCATCH(
199 mtx = su_mat_file_make_matrix(this->mf, "deltaT", 1, 1),
200 goto done);
201 SU_TRYCATCH(su_mat_matrix_write_col(mtx, 1 / fs), goto done);
202
203 SU_TRYCATCH(
204 mtx = su_mat_file_make_streaming_matrix(this->mf, "X", 2, 0),
205 goto done);
206 SU_TRYCATCH(su_mat_file_dump(mf, path.toStdString().c_str()), goto done);
207
208 ok = true;
209
210done:
211 if (!ok)
212 this->lastError =
213 "Cannot create Mat5 file "
214 + this->path
215 + ". See error log for details.";
216
217 return ok;
218}
219
220QString
221ExportSamplesTask::getLastError(void) const

Callers 1

attemptOpenMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected