Skip to content

Commit

Permalink
Added return of BF back to matlab
Browse files Browse the repository at this point in the history
  • Loading branch information
sflorescu committed Dec 13, 2024
1 parent ff5e666 commit fa21607
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion matlab/beamform_mex.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "tcbf.h" // include the header
#include "mex.h"
#include "tcbf.h" // include the header

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
if (nrhs != 7) {
Expand Down Expand Up @@ -29,6 +29,15 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
beamformer.process(RF, BF);
beamformer.write_BF(BF, path_bf);

mwSize dims[2] = {2 * pixels, frames};
mxArray *outArray = mxCreateNumericArray(2, dims, mxINT32_CLASS, mxREAL);
int32_t *outData = static_cast<int32_t *>(mxGetData(outArray));

// Copy the data
std::memcpy(outData, BF, totalElements * sizeof(int32_t));

// Assign output
plhs[0] = outArray;

int status = 0;

Expand Down

0 comments on commit fa21607

Please sign in to comment.