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
5
votes
3 answers

Matlab Engine Python - OSx Anaconda Segfault or DYLD_LIBRARY_PATH error with iPython

After installing the matlab python package in terminal using: cd "matlabroot\extern\engines\python" python setup.py install And trying to run it, I get a segfault: :~$ python Python 2.7.10 |Anaconda 2.3.0 (x86_64)| (default, May 28 2015, 17:04:42)…
InterwebIsGreat
  • 171
  • 1
  • 5
5
votes
1 answer

Why is matlab.engine for python so slow?

I'm calling MATLAB Functions from Python via the MATLAB Engine for Python, but it is rather slow. The original MATLAB script runs in 30 ms on my system, whereas the python script in little over 5 seconds. Is there a reason why? What should I do? The…
LzIManD
  • 53
  • 7
5
votes
1 answer

MATLAB engine versus libraries created by MATLAB Compiler?

To call MATLAB code in C or C++, how do you choose between using the MATLAB engine and using the MATLAB Compiler mcc to create C or C++ shared libraries from your MATLAB code? What are their pros and cons? For the second method, see…
Tim
  • 1
  • 141
  • 372
  • 590
4
votes
2 answers

"??? Undefined function or method" in Matlab Engine command window

I am working with Visual Studio on C++ code, and I send some variables to MATLAB engine. So far there is no problem. Imagine I have the MATLAB command window opened and these variables: » whos Name Size Bytes Class …
Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
4
votes
3 answers

Sending a matrix with each iteration: Matlab "engine.h" c++

This question comes after solving the problem I got in this question. I have a c++ code that processes frames from a camera and generates a matrix for each processed frame. I want to send to matlab engine each matrix, so at the end of the execution…
Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
4
votes
2 answers

Plotting quaternion in Matlab using "engine.h" from c++

I have an algorithm in C++ that uses Kalman Filter. Somewhere in the code a predict a Quaternion q' and then I update the Quaternion with Kalman Filter q. I want to plot two graphics in Matlab with the evolution of the predicted quaternion and the…
Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
4
votes
0 answers

Matlab engine for python in Windows doesn't accept matlab.double data type as functions argument

I am translating code from matlab to python. I am using matlab engine provided by mathworks to partially call chunks of the old matlab code in the midst of what it has already been translated to python. For example: //python already translated code…
4
votes
1 answer

dyld: Library not loaded: @rpath/libeng.dylib

I am trying to use the MATLAB Engine to invoke some MATLAB functions from C++ on MAC-OSX El Capitán. I've seen similar posts but none of them explains the situation calmly in a way that unprofessional people might understand. Can someone give me an…
Alexis R Devitre
  • 288
  • 2
  • 6
  • 21
4
votes
2 answers

Is there a way to change the title of the MATLAB Command Window?

I'm using the C++ API to fire up MATLAB (via engOpenSingleUse). Everything's working fine. But I'd like to change the title of the window from "MATLAB Command Window" to something else. I often have 4 or 5 of them open, and occasionally one gets…
Eric H.
  • 2,566
  • 2
  • 23
  • 34
4
votes
2 answers

Interrupt MATLAB programmatically on Windows

When using MATLAB through the GUI, I can interrupt a computation by pressing Ctrl-C. Is there a way to do the same programmatically when using MATLAB through the MATLAB Engine C API? On Unix systems there is a solution: send a SIGINT signal. This…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
4
votes
2 answers

MATLAB Engine: engEvalString() won't return if given incomplete input

I'm using the MATLAB Engine C interface on OS X. I noticed that if engEvalString() is given an incomplete MATLAB input such as engEvalString(ep, "x=[1 2"); or engEvalString(ep, "for i=1:10"); then the function simply never returns. The quickest…
Szabolcs
  • 24,728
  • 9
  • 85
  • 174
4
votes
1 answer

Data streaming in MATLAB with input data coming in from a C++ executable

I'm completely new to MATLAB and I want to know what my options are for data streaming from a C++ file. I heard of using the MATLAB "engine" for this purpose, and some of the methods like engPutVariable, etc., but can someone give me a thorough…
SuPra
  • 8,488
  • 4
  • 37
  • 30
3
votes
1 answer

How do I use Matlab engine in my code (for calling `engOpenSingleUse()`)?

I'm trying to send simple string commands to the Matlab engine. This is my code (there is no Matlab API related code anywhere else in my code, except for the #include "engine.h" line): void MatlabPlotter::DrawInMatlab() const { std::string…
hkBattousai
  • 10,583
  • 18
  • 76
  • 124
3
votes
5 answers

Passing C/C++ callbacks into the matlab engine

I have a C++ file that: starts the matlab engine calls matlab_optimize() (a compiled m file that runs one of matlab optimizers internally) prints the result stops the engine and quits This works fine. I now want to change the second line…
dgorissen
  • 6,207
  • 3
  • 43
  • 52
3
votes
1 answer

Assertion in MEX file causes Matlab to crash

I'm using the mxAssert-macro defined by matrix.h in my C++ code which mex perfectly compiles. When an assertion is violated in my called mex code, this assertion causes not my program to crash but Matlab itself. Am I missing something out? Is that…
Eric
  • 1,594
  • 1
  • 15
  • 29
1
2
3
12 13