mex

How to tell mex to link with the libstdc++.so.6 in /usr/lib instead of the one in the MATLAB directory?

妖精的绣舞 提交于 2019-12-17 09:42:05
问题 Now mex in MATLAB 2012a only officially supports gcc 4.4.6 but I want to use gcc 4.7 at my own risk. Now If I compile something with mex directly, it will complain that /usr/lib/gcc/i686-linux-gnu/4.7/cc1plus: /usr/local/MATLAB/R2012a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by /usr/lib/i386-linux-gnu/libppl_c.so.4) /usr/lib/gcc/i686-linux-gnu/4.7/cc1plus: /usr/local/MATLAB/R2012a/sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by

Using GCC (MinGW) as MATLAB's MEX compiler

风流意气都作罢 提交于 2019-12-17 02:34:41
问题 I've been given a project to run on MATLAB R2011a. As there are several .c files in there - I need to set up GCC as the MEX compiler for that project. However, I cannot seem to find any explanation as to how to set it up. I've tried a script program called gnumex - but it failed (probably set up for an older version of MATLAB). Any idea how to set it up? 回答1: In Matlab 2011b, just compile and link directly in mingw64 or cygwin environment. MINGWPATH=c:/MinGW64 CYGPATH=c:/cygwin MATLABROOT=c:

processing files in 64 bit machine but developing in 32 bit machine

江枫思渺然 提交于 2019-12-14 03:57:37
问题 i am going to read a TDMS file in matlab using Mexfunction in C language in a 64 bit windows machine, but i will develop the app in 32 bit windows machine. i know in there is a difference between 32 bit machine and 64 bits with the size of variables. i used a lot of fread(.. sizeof(type)..). is it going to be a problem when it is running in 64 bit machine? if so, how can i make it portable to 64 bits mahince? thanks 回答1: The more general problem is that you will have to know what the size of

Invalid glmnet Mex file in matlab

非 Y 不嫁゛ 提交于 2019-12-14 02:27:15
问题 I am running glmnet package on MATLAB 2019a in macOS 10.14.5. I have also installed Xcode in my laptop. I got the error like the following: Invalid MEX-file '/Users/Desktop/Research/Paper Code/glmnet/glmnetMex.mexmaci64' : dlopen(/Users/Desktop/Research/Paper Code/glmnet/glmnetMex.mexmaci64, 6): Library not loaded: @loader_path/libmex.dylib Referenced from: /Users/Desktop/Research/Paper Code/glmnet/glmnetMex.mexmaci64 I have tried the code mex -setup and got MEX configured to use 'Xcode with

mexFunction : mxDuplicateArray

≯℡__Kan透↙ 提交于 2019-12-13 22:24:03
问题 When I used mxDuplicateArray function, I met this error: cannot convert double* to const mxArray* {aka const mxArray_tag*} for argument 1 to mxArray* mxDuplicateArray(const mxArray*) . Is there anyone who knows how to fix it? This is part of my code: vector<int> *NNLt; double *NNLtout; Vector *V; Vector *Fb; mwSize *sn; mwSize nsn; mwSize nf; double hs; double bw; double mw; mwSize ncols; mwSize i; double *NNLtoutt; ... createNNLtriangle(NNLt, V, Fb, sn, nsn, nf, hs, bw, mw); plhs[0] =

error LNK2019: unresolved external symbol

北慕城南 提交于 2019-12-13 21:07:33
问题 I'm fresh in c++ and I'm facing a problem in including C++ code in Matlab C Mex-file. I have 5 files: RTIFederate.h , RTIFederate.cpp , RTIFedAmb.cpp , RTIFedAmb.h , RTI3.cpp . RTI3.cpp contains the MEX modules. I'm getting the following errors while compiling with MEX command and libraries: Creating library C:\Users\Nudel\AppData\Local\Temp\mex_DBx_sv\templib.x and object C:\Users\Nudel\AppData\Local\Temp\mex_DBx_sv\templib.exp RTI3.obj : error LNK2019: unresolved external symbol "class

Share data between multiple c mex s-functions

对着背影说爱祢 提交于 2019-12-13 20:30:42
问题 I am implementing several c s-functions. They have to rely on the same pointers and variables, inedependet of the current s-function. Basically I want to instantiate all variabels and pointers in one "setup" s-function (inside mdlInitialize) and then be able to use these variables an pointers in different s-functions in their mdlOutputs function. Every s-function will be written in c. I could not find any usefull hint in the mathworks help. Do you have any idea? Thanks. 回答1: There are several

Legacy MEX infrastructure is provided for compatibility

空扰寡人 提交于 2019-12-13 17:52:32
问题 There is this warning kind of message when compiling mexFunction files using the mex command in Matlab 2014b. Legacy MEX infrastructure is provided for compatibility; it will be removed in a future version of MATLAB. What is this supposed to mean? There comes a link with this message, but I did not find something useful. Also this question did not make me more wise. Will the MEX API vanish? Will there be a different interface? What is going to change exactly? Can anybody tell? 回答1: The

MATLAB, mex files, Fortran, warnings and errors

醉酒当歌 提交于 2019-12-13 04:52:47
问题 I'm not quite seeing the issue I'm having, and I've tried suggestions I've seen in other forum posts. I am trying to write a (fortran) mex file, per request of my boss. However, I was getting warnings when passing a matrix to my computational routine. If I ignored the warning, my MATLAB shut down. So now I'm trying a simpler program, an inner product. However, I am still getting the warning: "Expected a procedure at (1)" where (1) is at 'call innerProd(x,y,c)' underneath the x. I'm not sure

How to Return a Opencv image cv::mat to Matlab with the Mex C++ API

痞子三分冷 提交于 2019-12-13 03:30:53
问题 Iam currently using the Mex C++ API to take a picture with a Basler camera (Pylon API) and send it back to Matlab. I have some problems with converting an opencv cv::mat data type to a suitable type for Matlab. The solutions provided by Matlab (https://de.mathworks.com/help/vision/ug/opencv-interface.html) for converting opencv data types unfortunately only work with the older mex c api, so I cannot use them. I have managed the following workaround. This workaround uses two loops two assign