mex

How to print C-preprocessor variables like __LINE__ with mexErrMsgTxt() In Matlab MEX

淺唱寂寞╮ 提交于 2020-01-03 00:55:10
问题 For debugging Matlab-MEX, which can be quite a hassle, it would be nice to have better assertion capabilities. Following this question about mex-assertions, it is possible to define a preprocessor makro, that throws an error to Matlab and prints a string (can mostly replace mxAssert , which unfortunately crashes Matlab2011b). #define myassert( isOK,astr ) ( (isOK) ? (void)0 : (void) mexErrMsgTxt(astr) ) It would be much nicer to print the file, line number and caller function, from where

Linux (GLNXA64) using mxCreateUninitNumericMatrix R2013b

孤街醉人 提交于 2020-01-02 23:16:03
问题 In one MEX file, I created an output matrix with the command (working fine): plhs[0] = mxCreateNumericMatrix((mwSize)destLen, 1, mxUINT8_CLASS, mxREAL); For speedup I wanted to use the dynamic memory uninitialized, which lead me to the undocumented command: plhs[0] = mxCreateUninitNumericMatrix((mwSize)destLen, 1, mxUINT8_CLASS, mxREAL); working also very fine within Win32 and Win64. Using exactly the same code within my Linux environment leads to the following warning from compiler: warning:

building MATLAB jpeg toolbox with libjpeg8d

浪尽此生 提交于 2020-01-02 09:26:57
问题 This question is related to another question I asked here: Error reading image using jpeg_read from Matlab's jpeg toolbox I've been trying to compile the jpeg toolbox under Windows 7 (using the commands Shai provided in the answer to the question I posted), but I get the following error: jpeg_read.c(52) : fatal error C1083: Cannot open include file: 'jerror.h': No such file or directory which I believe happened because I haven't built libjpeg. I tried to build libjpeg6b like jpegtoolbox's

Periodically send data to MATLAB from mexFile

大兔子大兔子 提交于 2020-01-02 06:59:12
问题 I'm working right now on a Data Acquisition Tool completely written in MATLAB. It was the wish of my colleagues that i write this thing in MATLAB so that they can expand and modify it. The Software needs to grab a picture from two connected USB cameras. The API for these cameras is written in C++ and is documented -> Here. Here is the Problem: When i write a mex file which grabs a picture it includes the initialization and configuration-loading of the cameras which takes a long time. When i

Force MATLAB to reload library linked in mex function

浪尽此生 提交于 2020-01-01 04:43:31
问题 I have a Mex-function, say myfunction.mexmaci64 (which is the correct ending on OS X). Now, myfunction is linked against a library mylibrary.dylib . Both, mex-file and library, reside in the same folder. Now, whenever I change something in mylibrary , MATLAB does not reload the new library version but instead uses the old one until I do restart MATLAB. That is very anoing when doing development and debugging work. Is there a way to force MATLAB to reload the library without restarting the

Mex compiling on 64 bit linux - /usr/bin/ld: cannot find -lstdc++

心不动则不痛 提交于 2019-12-31 04:34:05
问题 Okay I am trying to compile a mex file on 64 bit linux, ubuntu to be precise with Matlab 2013a. First it gave a error that it could not find GLIBCXX_3.4.15 . Which was not part of the /usr/local/MATLAB/R2013a/sys/os/glnxa64/libstdc++.so.6 . I found this thread /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.15' not found and succesfully created a symbolic link ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.17 libstdc++.so.6 in /usr/local/MATLAB/R2013a/sys/os/glnxa64 Now I tried to compile

Mex function not updated after recompile

我与影子孤独终老i 提交于 2019-12-30 18:25:08
问题 I have a simple mex function, which calls another C++ function from a library. I compile the source with mex -cxx mymexfunction.cpp -I/some/include -L/some/lib -lmylib The mylib library is dynamic (.so) and is linked itself against some other libraries (boost, OpenCV and some more). The problem I am having is that once I have called the function mymexfunction once, it will not get updated when I recompile the source code. I have tried clear clear all clear mex clear functions clear fun(

Mex function not updated after recompile

空扰寡人 提交于 2019-12-30 18:25:07
问题 I have a simple mex function, which calls another C++ function from a library. I compile the source with mex -cxx mymexfunction.cpp -I/some/include -L/some/lib -lmylib The mylib library is dynamic (.so) and is linked itself against some other libraries (boost, OpenCV and some more). The problem I am having is that once I have called the function mymexfunction once, it will not get updated when I recompile the source code. I have tried clear clear all clear mex clear functions clear fun(

Matlab Mex library lifecycle

雨燕双飞 提交于 2019-12-29 04:45:11
问题 Does anyone know what the matlab mex library lifecycle is? Specifically I am interested in the following: Is there a way to force the library to be loaded before invoking it? Is the library a singleton or are multiple instances loaded? Are there any hooks for initialization prior to invocation? Is there a destructor hook/signal that can be intercepted when the library is unloaded for cleanup? I did an extensive search here and online and I could not find the answers to these questions. My

No Symbols Loaded: libmex.pdb not loaded (throw_segv_longjmp_seh_filter() = EXCEPTION_CONTINUE_SEARCH : C++ exception)

只愿长相守 提交于 2019-12-25 09:14:25
问题 In order to create a MEX function and use it in my MATLAB code, like this: [pow,index] = mx_minimum_power(A11,A12,A13,A22,A23,A33); I've created the file mx_minimum_power.cpp and written the following code in it: #include <math.h> #include <complex> #include "mex.h" #include "matrix.h" #include "cvm.h" #include "blas.h" #include "cfun.h" using std::complex; using namespace cvm; /* The gateway function */ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { const int