Questions tagged [matlab-engine]

MATLAB Engine is a library to call MATLAB® software from standalone programs, for example written in C/C++ or Fortran.

While files are DLLs encapsulating C/C++ or Fortran code to be used by a main program written in MATLAB, sometimes the inverse is necessary: A main program in C/C++ or Fortran needs to access MATLAB's capabilities. This can be done using MATLAB Engine, which is documented in the MATLAB online help.

Note that a second way to use MATLAB from C/C++ or Fortran is to turn the MATLAB code it be used into a library using MATLAB Compiler.

Questions should have this tag if they are about the use of MATLAB Engine specifically. If the issue also occurs with standalone MATLAB the tag should be avoided and be used instead.

183 questions
1
vote
2 answers

problem with nvmex in matlab

i have installed matlab on my system and also have installed the CUDA SDK for windows. however i am not able to compile any .cu files. I have included the nvmex script file in the bin directory of the Matlab installation path. Can some body help?
balazar
  • 21
  • 1
  • 4
1
vote
2 answers

MATLAB Engine API for Python. Error: MATLAB Engine for Python supports Python version

I'm working on my Master's Thesis. My director uses MATLAB, I use Python. So I need to run his MATLAB scripts on Python. There are many questions out there on this topic. I tried to install Install MATLAB Engine API for Python…
1
vote
0 answers

Using MATLAB's fmincon to minimize a Python function

I'm trying to use MATLAB with Python and would like to use MATLAB's fmincon to optimize a Python function. Here's an example of what I'm trying to achieve (in Python). import matlab.engine from scipy import stats m =…
gimi
  • 395
  • 3
  • 13
1
vote
1 answer

How to speed up this matlab-python connection?

Overview of my code: in python, I trained a GAN model to generate an image, given a vector of 8 numerical values (8 numbers ranging from -1 to 1). Let's call such a vector "noise". So, this CGAN model takes noise as input and then generates an…
srv_77
  • 547
  • 1
  • 8
  • 20
1
vote
0 answers

MATLAB Engine for Python is very slow

I have a main python script and I want to call a Matlab function (spm_filter.m) on an array. I use something like the following: import matlab.engine eng = matlab.engine.start_matlab() y_filtered = np.asarray(eng.spm_filter(filter_kernel,…
seralouk
  • 30,938
  • 9
  • 118
  • 133
1
vote
1 answer

Python Matlab engine use in Docker

I've a python script that executes a matlab script inside it with matlab.engine().This works on my machine but I'm not able to dockerize it. The dockerfile will need two images -Matlab and Python. The Matlab needs to initialize with the license…
Sai
  • 45
  • 1
  • 7
1
vote
1 answer

How to create a python 3 class to start MATLAB and keep it running?

I'm using matlab 2017b and python 3 on windows 10. I want to create a class that can start the matlab and keep it open. However, matlab closes right after I finished the python script. Here is the code: import matlab.engine class Test: def…
tamashika
  • 25
  • 5
1
vote
0 answers

How to quit debug from another session

I use a Matlab Engine API in order to verify my hdl design. Often, while testing I need to debug some matlab functions. Problem is when I forget to quit debug and then start another simulation, things will go wrong, so I decided to check if matlab…
1
vote
0 answers

MatlabExecutionError: Usage: with Psychtoolbox in MATLAB Engine API for Python

I am working on a Python script in which I have to call some Matlab Psychtoolbox functions to open a screen window and display a dot. I am trying to use the Matlab Engine API for Python: when running the code I get a MatlabExecutionError: Usage: for…
mordecai9
  • 11
  • 2
1
vote
1 answer

Matlab Engine API for C run-time dynamic linking

I'm using the Matlab Engine API in a C application and everything works fine but I now want to change it from load-time dynamic linking to run-time dynamic linking using the LoadLibrary() function. I can load the library and get the address of the…
1
vote
1 answer

EngineError: Transport stopped. by using MATLAB Engine for Python after activation of MATLAB

I installed the MATLAB Engine according to this solution and it also start, but by executing it, the following error occurs: Traceback (most recent call last): File "", line 1, in…
Dennis
  • 171
  • 3
  • 16
1
vote
1 answer

TimeoutError import error when using matlab engine with python 3.5

I am trying to run a function written in matlab in a python script using matlab.engine. The first time I run the script everything works fine, but when I try to run the script again I get the error "ImportError: cannot import name 'TimeoutError'" on…
user11573
  • 21
  • 2
1
vote
1 answer

Segmentation fault when running start_matlab in matlab engine

I'm using Mac OSX High Sierra anaconda3 python (virtual environment with python=3.6) Matlab R2018a. Steps to reproduce: Create a new python 3.6 environment. Activate the environment Go to Matlab/extern/engines/python and run python…
Dzung Nguyen
  • 3,794
  • 9
  • 48
  • 86
1
vote
1 answer

How can I find the total harmonic distortion of a nonlinear signal. Using matlab

How can I find the total harmonic distortion of a nonlinear signal. For example, Forced Van der pol Oscillator with code as shown below. I have tried the 'thd' function in matlab but I guess I'm missing somethings. This is the equation …
1
vote
0 answers

Matlab command window not using same path as full version

I use a DOS batch script to call the matlab Command Window (matlab -nodesktop -nosplash -noFigureWindows -r "myscript"), and the script relies on some functions in different folders, which are in my path. When I run this, the matlab Command Window…