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
3
votes
1 answer

C++ matlab engine c++ callback function

I'm writing an application which need to have some things done by the matlab engine. However, inside the matlab scripts I need some callback functions. Is it possible to create a callback function in a matlab script back to a c++ function?
Tiddo
  • 6,331
  • 6
  • 52
  • 85
3
votes
3 answers

How to install matlabengine (Windows 10, MATLAB R2020b, Python 3.8.10)

I have the following environment: Windows 10 Python 3.8.10 MATLAB R2020b I'm trying to install matlabengine (pip install matlabengine) package, and I'm getting the following error: RuntimeError: No compatible MATLAB installation found in Windows…
user3668129
  • 4,318
  • 6
  • 45
  • 87
3
votes
0 answers

real-time streaming data from Python to MATLAB

I would like to make a python variable available in real time in MATLAB. For example: Python code: import numpy as np x = [] for while 1: x.append(np.random.rand(1)) # send x to matlab after each/several python iterations .... MATLAB…
dleal
  • 2,244
  • 6
  • 27
  • 49
3
votes
1 answer

Square matrix flattened to row vector upon passing through MATLAB API for Python

I have a dataframe which holds covariance data, hence we have a square matrix. I translate this dataframe into numpy and then to list as below, so that I can use it with the matlab api: import matlab.engine eng =…
3
votes
1 answer

Creating .exe file with pyinstaller and Matlab engine

I have made an application using pyqt . when running from an IDE the .py files work good. However when running the .exe file using: pyinstaller --name="Myapp" --windowed --onefile main.py I get a .exe file. When I try to run it it says Failed to…
Payam30
  • 689
  • 1
  • 5
  • 20
3
votes
0 answers

Is there any way in Tensorflow 2.0 to pass a tensor as parameter of a Matlab function while running Matlab engine?

It is such a long title, but hopefully I will be able to explain myself properly in a few sentences: I am trying to minimize a given score function using Tensorflow inspired by what was published in Minimize a function of one variable in Tensorflow.…
3
votes
1 answer

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

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…
5Ke
  • 1,209
  • 11
  • 28
3
votes
0 answers

Importing MATLAB engine on Python using TextMate - Python quits unexpectedly

I am trying to call a MATLAB function from a Python script. I installed the MATLAB Engine API as instructed by the Mathworks website, and then importing the engine in my script using: import matlab.engine (using TextMate on Mac OS.) However I was…
Michele Tonutti
  • 4,298
  • 1
  • 21
  • 22
3
votes
1 answer

How to call "MATLAB engine for Python" in Django?

I have installed "MATLAB engine for Python" from MathWork. My python version is 3.4 and it works well if I put my own-written m.file together with .py file under the same folder. But everything went wrong when I want to use that engine in Django.…
miata
  • 81
  • 6
3
votes
1 answer

How to pass tuple to a Matlab function from Python

I have a Matlab function that I'm calling from a python script: import matlab.engine eng = matlab.engine.start_matlab() t = (1,2,3) z = eng.tstFnc(t) print z The function tstFnc is as follows: function [ z ] = tstFnc( a, b, c ) z = a + b + c This…
sodiumnitrate
  • 2,899
  • 6
  • 30
  • 49
3
votes
3 answers

Call matlab from a Python virtual environment

I can call MATLAB from my system python: >>> import matlab.engine >>> but when I load a virtual environment, I now get a segfault: >>> import matlab.engine Segmentation fault: 11 I've run the setup.py install instructions for both system python…
Nick Sweet
  • 2,030
  • 3
  • 31
  • 48
3
votes
3 answers

sparse matrix values as indexes to another matrix

S - NxN sparse matrix. A - Mx1 vector. The non zero values of S are the indexes of A. I want to calculate a vector x such that in the i'th entry of x: for each non zero value j in the i'th row of S , take A[j] and calculate the sum of all this j's…
IceCube
  • 405
  • 1
  • 5
  • 12
3
votes
2 answers

Does opencv have a function similar to size and bwperim in matlab?

I am new to opencv and good at matlab i want to write equalent of below to opencv [mm,nn]=size(binaryimage); bwperim(binaryimage); Please can any one help
smile
  • 169
  • 2
  • 4
  • 13
3
votes
1 answer

Accessing MATLAB's unicode strings from C

How can I access the underlying unicode data of MATLAB strings through the MATLAB Engine or MEX C interfaces? Here's an example. Let's put unicode characters in a UTF-8 encoded file test.txt, then read it…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
3
votes
1 answer

Should I be using a SWIG typemap for ruby Fixnum -> matlab mwSize?

I'm trying to update a project which uses SWIG to build an interface from ruby to matlab. The matlab C-API has changed and now I get the following error at runtime. `mxCreateDoubleMatrix_730': Expected argument 0 of type mwSize, but got Fixnum 20…
morri
  • 196
  • 7
1 2
3
12 13