mex

How to add header files path relative to the current file?

◇◆丶佛笑我妖孽 提交于 2019-12-24 01:17:12
问题 I have the file mx_minimum_power.cpp in the following directory D:\thesis library.Data\ALOS-PALSAR 12x2\San Francisco L 12x2 and 14 header files that I want to include to the cpp file in the following directory: D:\thesis library.Data\ALOS-PALSAR 12x2\San Francisco L 12x2\Eigen\Eigenvalues so the relative path to these .h files with respect to my .cpp file is \Eigen\Eigenvalues How should I include all those header files relative path. I've done so far: #include <math.h> #include <complex>

Segmentation Faults when Running MEX Files in Parallel

烂漫一生 提交于 2019-12-24 00:54:57
问题 I am currently running repetitions of an experiment that uses MEX files in MATLAB 2012a and occasionally running into segmentation faults that I cannot understand. Some information about the faults They occur randomly They only occur when I run multiple repetitions of my experiment in parallel on a Linux machine using a parfor loop. They do not occur when I run multiple repetitions of my experiment in parallel on Mac OSX 10.7 using a parfor loop. They do not occur when I run or do they occur

Compile jpeg_read.c as mexmaci64 for MATLAB

*爱你&永不变心* 提交于 2019-12-24 00:18:22
问题 I downloaded the jpeg_toolbox for MATLAB from this site, then downloaded the JPEG compiler tools from here. I followed the instruction to configure the whole for Mac (UNIX*). Now, I would need to compile the jpeg_read.c and jpeg_write.c contained into the first link for MATLAB, because the toolbox does not provide the mexmaci64 files. However when I try to: mex jpeg_read.c MATLAB returns the following error: Error using mex Undefined symbols for architecture x86_64: "_jpeg_CreateDecompress",

Does Matlab ever copy data passed to a mex function?

被刻印的时光 ゝ 提交于 2019-12-23 04:57:29
问题 Concerning lazy copying: Will Matlab ever copy data passed to a mexFunction, which modifies it? For instance in myMex(input1(:,:,ii), input2(:,:,ii)) can one be sure, that the input matrices are never copied, so that one can pass something in and modify it, without having to return a reference? 回答1: In certain cases, MATLAB implements some optimizations to avoid copying data when calling functions. With MEX-functions, the input as passed as const mxArray *prhs[] ( prhs is an array of pointers

Force explicit variable declaration with gfortran

风格不统一 提交于 2019-12-22 18:22:10
问题 I am linking some fortran code (f90) from matlab using mex and I am having matlab freeze occasionally. In the past, I had freezing happening due to mismatch between data types (say integer*4 vs integer*8). The code I am linking has many implicitly defined variables, so I am wondering if there is a hidden data type conflict that only occurs occasionally. To rule out data type mismatch as the cause of the freeze, I would like to have the compiler requiring all variables to be explicitly

MATLAB no longer supports user-defined MEX configuration?

本小妞迷上赌 提交于 2019-12-22 07:50:10
问题 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++

How to pass filepath variables to mex command?

谁都会走 提交于 2019-12-22 00:13:45
问题 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

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

为君一笑 提交于 2019-12-21 20:10:15
问题 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. 回答1: 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 *

Profiling a mex-function

你。 提交于 2019-12-21 08:03:20
问题 I have just rewritten a Matlab program in c++ as a mex-function to speed things up, with fantastic results. This optimization decision was a very very good idea, with up to a factor 20 speed up without threading. It still left me curious about what the mex-function was spending time on and wanting to identify possible bottlenecks. I'm looking for a way to profile mex-functions. The matlab profiler is not much use, and the other profilers I've downloaded (both free and trial) all want an

Profiling a mex-function

倖福魔咒の 提交于 2019-12-21 08:01:12
问题 I have just rewritten a Matlab program in c++ as a mex-function to speed things up, with fantastic results. This optimization decision was a very very good idea, with up to a factor 20 speed up without threading. It still left me curious about what the mex-function was spending time on and wanting to identify possible bottlenecks. I'm looking for a way to profile mex-functions. The matlab profiler is not much use, and the other profilers I've downloaded (both free and trial) all want an