From fa216072f3755646d4a4e0118536d0073327e22d Mon Sep 17 00:00:00 2001 From: sflorescu <43118429+sflorescu@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:31:24 +0100 Subject: [PATCH] Added return of BF back to matlab --- matlab/beamform_mex.cu | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/matlab/beamform_mex.cu b/matlab/beamform_mex.cu index d5528ac..bbd7778 100644 --- a/matlab/beamform_mex.cu +++ b/matlab/beamform_mex.cu @@ -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) { @@ -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(mxGetData(outArray)); + + // Copy the data + std::memcpy(outData, BF, totalElements * sizeof(int32_t)); + + // Assign output + plhs[0] = outArray; int status = 0;