This question shows how to return a double matrix to matlab using a map object. Pass C++ Eigen matrix to Matlab mex output The following works for non-complex data. double *outputPtr; plhs[0] = mxCreateDoubleMatrix((mwSize)n, (mwSize)m, mxREAL); outputPtr = mxGetPr(plhs[0]); Map<MatrixXd> output(outputPtr, n, m); Since matlab stores real and complex elements of a matrix separately rather ..

#### Category : matlab

I have a problem with MEX files in C/C++ coding. I need to return a double complex array to Matlab but I am not able to do that and I don’t find information about it. I show my code with some tries: double complex output[nSymb]; nlhs = 1; plhs[0] = mxCreateDoubleMatrix(nSymb,(mwSize)nlhs,mxCOMPLEX); plhs[0] = output; memcpy(plhs, ..

There are certainly some differences between a macro and a function But I want to know that is it okay that we say that macros in c/c++ are same as script in MATLAB? The difference between macro and function in c/c++ is same like the difference between script and function in MATLAB? Source: Windows Questions ..

I was watching a YouTube video at link https://m.youtube.com/watch?v=WvlXQ5TH8q8 There was a term used "IP" in that video , also that term is available in description of that video What is that term actually? It doesn’t look like to have common meaning of ip=internet protocol Source: Windows Que..

In a .cpp file i have icluded the following #include "MatlabDataArray.hpp" #include "MatlabEngine.hpp" And I get the following error: fatal error: MatlabDataArray.hpp: No such file or directory the path of the files is /usr/local/MATLAB/R2020b/extern/include/ and I have tried to put it in the c_cpp_properties.json: { "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/**", "../../../../usr/local/MATLAB/R2020b/extern/include", "/usr/local/MATLAB/R2020b/extern/include/**", ..

I have a MATLAB function that I saved in a .m file of the same name: function a = addmtx(a1, a2, f_callback) a = a1 + a2; f_callback(a1*2, a2*2); end then I compiled that .m file as a c++ shared library by matlab Library compiler. The compiled addmtx.h header for C++ has the following function: ..

Does anybody know why the following vector called random_pG is not filling up from a CSV file? # include <iostream> # include <stdlib.h> # include <string.h> # include <fstream> # include <vector> # include <sstream> // std::stringstream using namespace std; double random_pG[150]; double random_z_prev[150]; double zi_prevCells[150][4]; //Functions prototypes void ReadData1(double random_pG[], string); void ReadData2(double zi_prevCells[][4], ..

I have compiled mex file from C++ code: #include "mex.h" #include "matrix.h" #include "fdtd-macro.h" #include "copyMatrix.cpp" #include "global_var.h" int nx,ny,nz,linearSizeEx,linearSizeEy,linearSizeEz; int ExM,ExN,ExP,EyM,EyN,EyP,EzM,EzN,EzP,HxM,HxN,HxP,HyM,HyN,HyP,HzM,HzN,HzP; double *Ex,*Ey,*Ez,*tmpEx,*tmpEy,*tmpEz; const mwSize *dimEx,*dimEy,*dimEz; const mwSize *dimCexe,*dimCexhy,*dimCexhz,*dimCeye,*dimCeyhx,*dimCeyhz,*dimCeze,*dimCezhx,*dimCezhy; using namespace std; void mexFunction(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[]) { //read input from MATLAB calling Ex = mxGetPr(prhs[0]); Ey = mxGetPr(prhs[1]); Ez ..

I am using a simple matlab code to send serial data to a COM port device, however I am having issues and would like an equivalent C/C++ code to achieve the same result. Shown below is the MATLAB code. s_port = serialport(‘COM1′,9600); configureTerminator(s_port,’CR’); write(s_port,char([50 01]),"char"); pause(1) write(s_port,char([16 2 150]),"char") write(s_port,char([55 18]),"char") write(s_port,char(54),"char"); I attempted to ..

please I’m asking you if can someone helps me to understand how we can calcul a parametric card FA for acquisitions in DTI ? Thank you in advance. Source: Windows Que..

## Recent Comments