Questions tagged [mex]

MEX-files (MEX stands for Matlab EXecutable) are dynamically linked subroutines produced from C, C++ or Fortran source code that, when compiled, can be run from within MATLAB® in the same way as MATLAB functions or built-in functions.

In general, MATLAB can be quite efficient in performing a wide variety of numerical tasks. However, from time to time there are certain tasks that require more "low-level" control over the execution. For these kind of tasks MATLAB allows for an easy interface to C/C++/Fortran subroutine pre-compiled and ready to be used as any built-in function.

Here are some useful links for MEX-files:

1483 questions
-1
votes
1 answer

Accessing real and imaginary parts of cusp::complex vector

I need to access the real and imaginary parts of a cusp::complex type vector, for the purpose of sending it to a matlab variable through, mex. How do I access the real and imaginary parts separately of a vector of type. …
-1
votes
1 answer

How to read mex.c file in Matlab code

I have a Matlab code for measurement and when I try to run it this error pops up: Undefined function `mexLoadMeasurements` for input arguments of type `char`. Error in LoadMeasurements (line 56) measurements = mexLoadMeasurements(attr.Name); I…
Sam
  • 457
  • 1
  • 7
  • 15
-1
votes
2 answers

MATLAB mex c + Fortran Error

I'm trying to mex a project made up of files written in c and fortran. In order to make it easy I created this simple funcions: mysum.f SUBROUTINE mysum(a,b) REAL :: a,b,r r = a+b WRITE(*,*) r END SUBROUTINE mysum and test.c #include…
user2279697
  • 713
  • 1
  • 6
  • 10
-1
votes
2 answers

Visual Studio - How to translate mex code from matlab to C++

I want to translate a Matlab project in C++ by using Visual Studio. In my Matlab project I also have some mex file with given code. By given code I mean a .cc code with the actual code of the mex function. How can I use that code directly in C++? I…
Simon
  • 4,999
  • 21
  • 69
  • 97
-2
votes
1 answer

How to convert varibles correctely between matlab (matrix, cell) and c++ (vectors or self-defining class) in Mexfile

I've just begun to use mex file, and I met some problems while converting varibales in the mexfunction, especially when I want to convert a matrix to a self-defining class (e.g. Vector in "vema.h") and a cell to a vector in MexFunction. We have…
-2
votes
1 answer

Error in Mex file Execution, Matlab windows

I have been trying to compile some mex files in matlab. The file was compiling well but it was throwing the following error while i ran it. Invalid MEX-file 'filename.mexw32': The specified procedure could not be found. I have narrowed down the…
tej mohan
  • 37
  • 2
-2
votes
1 answer

call c function from matlab

I got lots of trouble to call c function from matlab. My c function is simple test.c #include "mex.h" int addOne(int a) { return a+1; } I typed mex test.c in matlab command window, I got this error message Undefined symbols for architecture…
fnhdx
  • 321
  • 2
  • 5
  • 14
-2
votes
2 answers

An error cannot convert from 'void *' to 'float *' `

I write a c++ function and its associated mex. But the one kind of input of c++ function is double *. The output of function pointwise_search is a pointer. I was told that I should delete it. But I do not know where I should delete it since I need…
Vivian
  • 207
  • 1
  • 3
  • 11
-2
votes
1 answer

Compiling MEX file from C

I have some trouble generating a MEX file from the following C function: #include #include void mexFunction(int nlhs, mxArray *plhs[], /* Output variables */ int nrhs, const mxArray *prhs[]) /* Input variables…
-2
votes
1 answer

how to use opencv and engine.h

can you give me a basic c++ code that inclue opencv libraries , and can call the matlab engine ? the file should compile using matlab mex. (my problem is when I use the engine and compile it with "mex -f optionfile file.cpp"I get error message…
-2
votes
1 answer

C++/CLI, MEX: Error C3767 candidate function(s) depending on function argument type

I'm working a mex solution that is structured like this: I have a C# reader A, which is called by a C++/CLI project B, which is called by a mex project C, which is called from matlab. This is not my code, just something I'm supposed to get running.…
Mårten
  • 231
  • 2
  • 14
-2
votes
1 answer

problems of memory manager in matlab and C

Possible Duplicate: memory allocation in matlab I was searching for solving a memory leak problem in C project which calls a DLL generated from MATLAB, and I found this link. Are what is written in that link is true? Can any one explain it in…
Omar Osama
  • 1,401
  • 3
  • 19
  • 29
1 2 3
98
99