mex

Is it possible return cell array that contains one instance in several cells?

只谈情不闲聊 提交于 2019-11-28 01:03:54
问题 I write some mex function and have to return huge array of strings. I do this as following: mxArray * array = mxCreateCellMatrix(ARRAY_LEN, 1); for (size_t k = 0; k < ARRAY_LEN; ++ k) { mxArray *str = mxCreateString("Hello"); mxSetCell(array, k, str); } prhs[0] = array; However, since the string has always same value, I would like to create only one instance of it. like mxArray * array = mxCreateCellMatrix(ARRAY_LEN, 1); mxArray *str = mxCreateString("Hello"); for (size_t k = 0; k < ARRAY_LEN

MEX compile error: unknown type name 'char16_t'

两盒软妹~` 提交于 2019-11-27 18:34:45
I cannot compile any MATLAB MEX code due to the following error: In file included from /Applications/MATLAB_R2013a.app/extern/include/mex.h:58: In file included from /Applications/MATLAB_R2013a.app/extern/include/matrix.h:294: /Applications/MATLAB_R2013a.app/extern/include/tmwtypes.h:819:9: error: unknown type name 'char16_t' typedef char16_t CHAR16_T; The only thing that has changed on my machine as far as I can remember is that Xcode was updated to version 5.1 (5B130a). Any fix for the time being to compile MEX code in MATLAB? [Running on OS 10.9.2 with Apple LLVM version 5.1 (clang-503.0.38

What was the difference between WSDL & Mex Endpoint in WCF

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 18:30:42
I have couple of question on mex endpoint. In legacy web services, we create a proxy using wsdl. The WSDL exposes the web service's meta data. In wcf, another term comes that mex endpoint, which also exposes meta data, but wsdl is still alive in wcf. I am new to wcf, and I am confused regarding the difference between wsdl & mex endpoint ? What is the meaning of httpGetEnabled="false" or httpGetEnabled="true" ? If I set httpGetEnabled="false" then what will happen? Does it mean the client will not be able to add service reference from their IDE? But if I set httpGetEnabled="false" , and saw

Split 3D MatND into vector of 2D Mat opencv

孤街醉人 提交于 2019-11-27 16:44:26
问题 Is it possible to get a 2D Mat object from a 3D data cube stored as MatND in opencv? Basically I'm passing a 3D matrix to a MexFile using "mexopencv". I convert the matrix to a MatND object by using MxArray(prhs[0]).toMatND(). Now I want to split up this datacube along the third dimension into a vector of cv::Mat matrices. I need to make operations on these 2D matrices an therefore iterate over the third dimension. Is there a function to split the data cube as needed? Or maybe a way to get a

FFTW vs Matlab FFT

浪子不回头ぞ 提交于 2019-11-27 14:20:59
问题 I posted this on matlab central but didn't get any responses so I figured I'd repost here. I recently wrote a simple routine in Matlab that uses an FFT in a for-loop; the FFT dominates the calculations. I wrote the same routine in mex just for experimentation purposes and it calls the FFTW 3.3 library. It turns out that the matlab routine runs faster than the mex routine for very large arrays (about twice as fast). The mex routine uses wisdom and and performs the same FFT calculations. I also

matlab in C C++ and C C++ in matlab [closed]

若如初见. 提交于 2019-11-27 14:01:30
问题 It seems that are several ways to call matlab in C C++ and to call C C++ in matlab. While I try to list them here, please point it out If I miss something. To call C C++ in matlab, there are also two methods. The first one is to call functions in C shared libraries. The second one is to build C C++ code into binary MEX-files, which will be called from the MATLAB command line. For the first method, are the C shared libraries are just general ones, i.e. without change to their C code for matlab

Mex files: how to return an already allocated matlab array

自作多情 提交于 2019-11-27 09:09:12
I have found a really tricky problem, which I can not seem to fix easily. In short, I would like to return from a mex file an array, which has been passed as mex function input. You could trivially do this: void mexFunction(int nargout, mxArray *pargout [ ], int nargin, const mxArray *pargin[]) { pargout[0] = pargin[0]; } But this is not what I need. I would like to get the raw pointer from pargin[0] , process it internally, and return a freshly created mex array by setting the corresponding data pointer. Like that: #include <mex.h> void mexFunction(int nargout, mxArray *pargout [ ], int

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

喜你入骨 提交于 2019-11-27 08:26:13
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 /usr/lib/i386-linux-gnu/libppl.so.9) By strings /usr/lib/i386-linux-gnu/libstdc++.so.6 | grep 'GLIBCXX'

How to return a float value from a mex function, and how to retrieve it from m-file?

岁酱吖の 提交于 2019-11-27 07:46:36
问题 I understand that all the returned values of a mex function are stored in plhs array of type mxArray*. I want to return a value of type float. How can I do it? Some code examples on returning it from the mex function and retrieving it from the m-file is much appreciated. 回答1: The MATLAB class name for float type data is "single". In the MEX-file you could write: void mexFunction(int nlhs, mxArray * plhs[], int nrhs, const mxArray * prhs[]) { // Create a 2-by-3 real float plhs[0] =

mex with MATLAB2013a Unrecognized switch: -o

自古美人都是妖i 提交于 2019-11-27 07:10:12
问题 I am trying to run a code which compiles some c++ codes using mex. I have set up mex with Microsoft Visual C++ 2010. But when I execute the line mex -O fconv.cc -o fconv I get the error compile Usage: MEX [option1 ... optionN] sourcefile1 [... sourcefileN] [objectfile1 ... objectfileN] [libraryfile1 ... libraryfileN] Use the -help option for more information, or consult the MATLAB API Guide. C:\PROGRA~1\MATLAB\R2011A\BIN\MEX.PL: Error: Unrecognized switch: -o. I have googled a lot but couldn