matlab-engine

Starting Matlab engine in anaconda virtual environment returns 'Segmentation fault (core dumped)'

一个人想着一个人 提交于 2019-11-29 12:30:20
I've installed the official MATLAB Engine by following the instructions from the answer to Anaconda install Matlab Engine on Linux to an Anaconda virtual environment running Python3.5. I can now import matlab and matlab.engine without receiving errors. However, when I try: matlab.engine.start_matlab() , I get 'Segmentation fault (core dumped)' I've tried setting LD_LIBRARY_PATH from within the conda environment (in case that is even relevant): export LD_LIBRARY_PATH=/System/Library/Frameworks/Python.framework/Versions/Current/lib:$LD_LIBRARY_PATH , but to no avail. The path doesn't exist

Set processor affinity for MATLAB engine (Windows 7)

淺唱寂寞╮ 提交于 2019-11-29 06:58:39
I'm developing an application in c++. One of the components of the application uses Matlab (via the Matlab engine) for data processing. At the same time, a data acquisition system is streaming data to disk. Occasionally, during periods of intensive Matlab processing, the acquisition system crashes. By setting the processor affinity of Matlab to a subset of available processors, this problem is resolved. However, as the application is launched a few times daily, and on multiple machines, manually setting the affinity each time is inconvenient. The trick of setting processor affinity via the

How to efficiently convert Matlab engine arrays to numpy ndarray?

余生颓废 提交于 2019-11-29 03:05:36
问题 I am currently working on a project where I need do some steps of processing with legacy Matlab code (using the Matlab engine) and the rest in Python (numpy). I noticed that converting the results from Matlab's matlab.mlarray.double to numpy's numpy.ndarray seems horribly slow. Here is some example code for creating an ndarray with 1000 elements from another ndarray, a list and an mlarray: import timeit setup_range = ("import numpy as np\n" "x = range(1000)") setup_arange = ("import numpy as

How to Call Matlab Functions from C++

百般思念 提交于 2019-11-28 22:54:19
问题 I want to call MATLAB function in my C++ project. I'm using Matlab R2010a and Visual Studio 2010 First I created a simple matlab function: function y = foo(x) y = x+1; and then I used matlab compiler to compile this function using matlab GUI compiler (File-> new -> Deployment Project and then choose C++ shared Library). It produces this files 2 folders: distrib and src. distrib contains: foo.dll foo.h foo.lib src contains : foo.cpp foo.dll foo.exp foo.exports foo.h foo.lib foo_mcc_component

Calling matlab from C++

早过忘川 提交于 2019-11-28 10:21:19
I tried to call matlab from a .cpp file. I used the following command to compile engdemo.cpp which includes "engine.h" g++ engdemo.cpp -I/usr/local/matlabR2010a/extern/include -L/usr/local/matlabR2010a/extern/lib -o engdemo What I got is the following: engdemo.cpp:(.text+0xdb): undefined reference to `engOpen' engdemo.cpp:(.text+0x12d): undefined reference to `mxCreateDoubleMatrix' engdemo.cpp:(.text+0x143): undefined reference to `mxGetPr' engdemo.cpp:(.text+0x175): undefined reference to `engPutVariable' engdemo.cpp:(.text+0x189): undefined reference to `engEvalString' ... collect2: ld

Starting Matlab engine in anaconda virtual environment returns 'Segmentation fault (core dumped)'

不打扰是莪最后的温柔 提交于 2019-11-28 06:30:30
问题 I've installed the official MATLAB Engine by following the instructions from the answer to Anaconda install Matlab Engine on Linux to an Anaconda virtual environment running Python3.5. I can now import matlab and matlab.engine without receiving errors. However, when I try: matlab.engine.start_matlab() , I get 'Segmentation fault (core dumped)' I've tried setting LD_LIBRARY_PATH from within the conda environment (in case that is even relevant): export LD_LIBRARY_PATH=/System/Library/Frameworks

Set processor affinity for MATLAB engine (Windows 7)

本秂侑毒 提交于 2019-11-28 00:29:45
问题 I'm developing an application in c++. One of the components of the application uses Matlab (via the Matlab engine) for data processing. At the same time, a data acquisition system is streaming data to disk. Occasionally, during periods of intensive Matlab processing, the acquisition system crashes. By setting the processor affinity of Matlab to a subset of available processors, this problem is resolved. However, as the application is launched a few times daily, and on multiple machines,

matlab in C C++ and C C++ in matlab [closed]

若如初见. 提交于 2019-11-27 14:01:30
问题 It seems that are several ways to call matlab in C C++ and to call C C++ in matlab. While I try to list them here, please point it out If I miss something. To call C C++ in matlab, there are also two methods. The first one is to call functions in C shared libraries. The second one is to build C C++ code into binary MEX-files, which will be called from the MATLAB command line. For the first method, are the C shared libraries are just general ones, i.e. without change to their C code for matlab

Thread safety of Matlab engine API

感情迁移 提交于 2019-11-26 23:11:14
问题 I have discovered through trial and error that the MATLAB engine function is not completely thread safe. Does anyone know the rules? Discovered through trial and error: On Windows, the connection to MATLAB is via COM, so the COM Apartment threading rules apply. All calls must occur in the same thread, but multiple connections can occur in multiple threads as long as each connection is isolated. From the answers below, it seems that this is not the case on UNIX, where calls can be made from