mex

MATLAB no longer supports user-defined MEX configuration?

人盡茶涼 提交于 2019-12-05 08:54:59
I've upgraded my MATLAB to 2014b (on OS X 10.10), and tried to test some old MEX C/C++ codes. As usual, I run mex -setup from the command window, and I would expect to be provided the chance to overwrite the option file "meshopt.sh". But now, it seems MATLAB has made some change and I am not allowed to change the MEX configuration, it simply says: MEX configured to use Xcode with Clang for C language compilation, ... to choose a different language, select one from the following mex -setup C++ mex -setup FORTRAN So, is it true that the old ways to modify "mexopts.sh" are no longer feasible? It

How to install SPAMS toolbox in Matlab 2014b under windows 8.1

ぐ巨炮叔叔 提交于 2019-12-05 00:57:43
问题 I am trying to learn how to successfully compile "Sparse Modeling Software" (SPAMS) in my machine which uses a Windows 8.1 OS and MATLAB R2014b. The steps I have taken are as followed (some parts might have been unnecessary or missing) Step 1. Installed "Microsoft Visual C++ 2013 Professional". Step 2. Installed "Microsoft Windows Software Development Kit (SDK)". Step 3. Download "spams-matlab-v2.4-svn2014-02-18.tar" from http://spams-devel.gforge.inria.fr/ Step 4. Unzip it in Windows using 7

How to pass filepath variables to mex command?

十年热恋 提交于 2019-12-04 17:58:20
Currently trying to create a minimal example of scripted mex file generation. I have a MATLAB .m script that I am running to generate mex files. I would like to pass in all the arguments as variables so that I can automate a bunch of mex file construction when given a list of filenames/paths. #1 : unknown argument -outdir input = ' -outdir C:/Users/ian/mexTesting/mexFiles' mex('src/helloworld.cpp', input) #2 : unknown filepath / can't find location (interprets entire string as path to mex file) input = 'src/helloworld.cpp -outdir C:/Users/ian/mexTesting/mexFiles' mex(input) #3 : same issue as

mex transferring a vector from c++ to matlab from mex function

∥☆過路亽.° 提交于 2019-12-04 11:53:59
I am trying to speeden up my Matlab program by writing a few functions in C++ and using the mex interface to integrate them. I got my results in a vector in c++. I want to transfer it to an array in MATLAB. I know i should redirect plhs[0] to the vector but i am not getting how exactly should I do it. When I've done similar things, I manually marshal the data so that it won't be freed when the C++ routine is completed. Here's a basic outline: #include <vector> #include "mex.h" mxArray * getMexArray(const std::vector<double>& v){ mxArray * mx = mxCreateDoubleMatrix(1,v.size(), mxREAL); std:

MATLAB parfor and C++ class mex wrappers (copy constructor required?)

徘徊边缘 提交于 2019-12-04 11:10:58
问题 I'm trying to wrap a C++ class in a matlab mex wrapper using the approach outlined here. Basically, I have an initialization mex file which returns a C++ object handle: handle = myclass_init() I can then pass this to another mex file (e.g. myclass_amethod ) which use the handle to call class methods, then ultimately to myclass_delete to free the C++ object: retval = myclass_amethod(handle, parameter) myclass_delete(handle) I've wrapped this up in a MATLAB class for ease of use: classdef

GLIBCXX not found when compiling vtk example under mex

南楼画角 提交于 2019-12-04 10:54:24
I have been trying to follow this example for compiling vtk in MATLAB using mex, on an Ubuntu 11.10. The mex command I used is as follows: mex -I/usr/include/vtk-5.6 vtk_file.cpp -L/usr/lib/ -lvtkFiltering -lvtkRendering -lvtkCommon After compilation I have a .mexa64 file. However, when I try to run the file I end up with the following error: Invalid MEX-file '/home/bill/Documents/MATLAB/vtk/vtk_file.mexa64': /usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libvtkFiltering.so.5.6) How can I ensure that glibcxx is

Output a matrix with c++ and mex

房东的猫 提交于 2019-12-04 06:56:18
问题 I have a problem with my c++ code. I want to return a matrix of k-dimensions from my cpp program to Matlab. The matrix I want to pass is stored in all_data , and is a matrix of size (npoints+1) x ndims . I have been looking how to do that, and I have come up with: //send back points vector< vector <double> > indexes = mxGetPr(plhs[0]); for (int i=0; i < (npoints1+1); i++) for (int j=0; j < ndims1; j++) indexes[ i ][ j ] = all_data[ i ][ j ]; But it does not work, as all_data is a vector

Mex generates error for // while compiling C code in Linux

╄→尐↘猪︶ㄣ 提交于 2019-12-04 04:58:09
问题 I want to compile a C code in ubuntu using mex which is configured with gcc. I can smoothly compile the code in OSX. However, when I want to compile it in Linux, the compiler generates the error on the comment lines starting with // (it works fine with /* */ . Since the program includes several header files from third-party libraries, I cannot substitute // with /* */ . I would like to know whether there is any way around to overcome this problem. MATLAB version: R2012b gcc version in Linux:

How to provide Matlab with the old gcc version it wants?

旧城冷巷雨未停 提交于 2019-12-04 03:25:12
On my computer I have Ubuntu 10.10 with gcc 4.4.4. I try to compile some mex files which use CUDA and I get following error message: >> cns_build('hmax') compiling... /home/leMe/hmax/cns/source/common_dec.h(54): warning: omission of exception specification is incompatible with previous function "operator new(size_t)" /usr/include/c++/4.4/new(91): here /home/leMe/hmax/cns/source/common_dec.h(55): warning: omission of exception specification is incompatible with previous function "operator new[](size_t)" /usr/include/c++/4.4/new(92): here /home/leMe/hmax/cns/source/common_dec.h(56): warning:

Debug a mex function in Visual Studio

随声附和 提交于 2019-12-03 21:42:03
问题 I'm trying to wrap existing C++ code into a MATLAB callable function. I'm using Visual Studio 2013 to generate the MEX file . The MEX file is created properly, I can call it from MATLAB and pass arguments back and forth without any issues. Now I want to debug my C++ logic, and I can't seem to get it to work. I've created an m script that calls my function, and had Visual Studio run MATLAB when debugging - as explained here . When I hit F5 to debug my MEX file, Visual Studio runs MATLAB, and