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

Get matrix size from a pointer- MEX

I read the second variable in C++ #define D prhs[1] double* d = mxGetPr(D); // get the pointer Now I want to get the size of D int mySize = mxGetM(D); cool...Now how can I get the size from the pointer d (not D)? int mySize = mxGetM((const…
mask
  • 539
  • 1
  • 5
  • 18
-1
votes
2 answers

Call mexCallMATLAB from C#

I´m trying to use Pinvoke to call Matlab functions from C#. My project configuration is: C++ Project that uses "mex.h" to call "mexCallMATLAB" interface Example: #include "stdafx.h" #include #include #include…
guilhermecgs
  • 2,913
  • 11
  • 39
  • 69
-1
votes
1 answer

MEX fortran file using Gnumex and MinGW (g77)

There is a problem that I ran into recently. It used to be working fine as far as I remember but after a few week I am trying again to MEX a fortran 77 file in MATLAB but it is giving me a weird error. Ok, I made the MEX options file using Gnumex…
Omid
  • 260
  • 1
  • 2
  • 11
-1
votes
1 answer

Invalid MEX-file error CascadeClassifier_.mexmaci64, libopencv_ocl.2.4.dylib

I am on OSX 10.10. I am trying to run a demo of a project which uses the following libraries and programs: MATLAB R2014b 64-bit. OpenCV 2.4.10.1 installed through Homebrew. VLFeat 0.9.20. mexopencv. I have run mex -setup in MATLAB…
-1
votes
3 answers

finding local mean in an image using mex-cuda

I have an image named HSIImage, of size is 565x585, in which I have find the local mean and standard deviation at every pixel. For this I am using a window W of size 9x9, if we a re finding the mean of x(i,j) we need values in the W where x(i,j) is…
Pawan
  • 423
  • 6
  • 28
-1
votes
1 answer

setting sampling time in c mex s func

What is the equivalent of the following for a C-mex s function? That is, how do I set discrete sample time of a block to the top level fixed step size in C? My problem is, I could not find a way to "get" the top level fixed step size parameter in…
-1
votes
1 answer

MATLAB linking wrong OpenCV folder (OS X)

I'm running some MATLAB code (OpenTLD) that calls OpenCV, however it appears I have duplicates of some of the dylibs which is confusing…
chris
  • 4,840
  • 5
  • 35
  • 66
-1
votes
1 answer

Old gcc compiler on matlab

I am using MATLAB on the Linux MINT. I have a C program for which I want to used mex command as follows: mex /home/.../binary.c -output binary_m but I get the following error Warning: You are using gcc version "4.8.1-10ubuntu9)". The version …
user42037
  • 39
  • 7
-1
votes
1 answer

Setting environment variable when using Mex environment

I am currently using a package called Cuba, and I would like to use it within a Matlab mex environment. The problem is, how can I set the environment variable CUBACORES to disable the automatic parallelization? This does not work with mex: export…
lorniper
  • 626
  • 1
  • 7
  • 29
-1
votes
2 answers

How can I compile ANSI C99-based MEX code delivered with Linux makefiles under Win64 MATLAB?

It seems I've got a real problem here due to my lack of any knowledge about Linux systems: I have downloaded some open source code, which is written in C uses complex.h, so I assume it is ANSI C99 comes with makefiles designed for compilation…
Michael
  • 280
  • 2
  • 13
-1
votes
1 answer

How to run C codes in matlab

I want to run a c++ code in Matlab, in my code I have this int max=(int)*mxGetPr(prhs[0]); double a[max]; but when I use mex it has these errors error C2057: expected constant expression error C2466: cannot allocate an array of constant…
amanda
  • 33
  • 1
  • 7
-1
votes
2 answers

Undefined reference to shared library functions after converting from C to C++

I have a shared library `libsharedlib.so' which used to be generated from C files. Since the library now needs to use functions from a 3rd party C++ library, I would like to convert my shared library from C to C++ (the code is relatively simple).…
lodhb
  • 929
  • 2
  • 12
  • 29
-1
votes
1 answer

Error LNK2019: unresolved external symbol in matlab

I have been at this for 2 days and have tried every possible solution I can find via a search engine. But I still am stuck here. I downloaded a package for superpixel implementation from here. The function is in C++, but a mex file has been…
Lakshmi Narayanan
  • 5,220
  • 13
  • 50
  • 92
-1
votes
1 answer

Regarding Mex & WSDL issue in WCF

What is the importance of this setting httpGetEnabled="false" or httpGetEnabled="true" what will happen if we set httpGetEnabled="false" suppose if I want any .Net 2.0 client can consume my wcf service which has been developed by .Net 4.0 then how…
Mou
  • 15,673
  • 43
  • 156
  • 275
-1
votes
1 answer

how to call a matlab/octave function from GTK+2 C code

how a built-in matlab/octave function can be called from a GTK+2 C code. i know how to call octave functions from C code by Mex files, but i don't know how i can call matlab/octave function from GTK+2 C code. is it possible to use Mex files to call…
user3132152
  • 103
  • 4
1 2 3
98
99