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

A step by step guide to easily send OpenCV C++ variables to Matlab

I want to be able to send any OpenCV variables to Matlab in order to plot graphs and calculate statistics in a confortable way. I know I have to use Matlab Engine, but there is little help on the web about how to make it accessible from any part of…
Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
2
votes
1 answer

Using Matlab "engine.h" from c++ correctly

I have a code that proceses frames in each iteration and generatesa matrix. My final goal is to send the matrix data to matlab in order to examine the evolution of the matrix with each frame. In order to achieve this I defined a static variable…
Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
2
votes
1 answer

How to call a Matlab function in Python from matlab.engine using the user's input (variable of type string) as the name of the function?

I have a Matlab function name as a string (the variable name is 'function_name'), which is an input from a user, and I need to somehow call that function from Python. Below you can see how I was trying to call this function using the variable name,…
rarush
  • 23
  • 4
2
votes
0 answers

Calling MATLAB Engine from Cocoa Application

I'm writing a Cocoa application and I'm trying to link it with the MATLAB Engine to call MATLAB functions. So far I've added the .app/extern/include/ directory (the one that contains the engine.h header) to the header search paths (and subsequently…
jstm88
  • 3,335
  • 4
  • 38
  • 55
2
votes
1 answer

Keep MATLAB engine open in C++ dll

I want to create a dll which keeps an instance of the MATLAB engine open for use by other scripts. That is, the goal is to not have to keep initialising and closing the MATLAB instance, which takes time. For some background, I have a working C++…
James
  • 99
  • 6
2
votes
1 answer

Return MATLAB structure to C++ and access the elements

I'm trying to run MATLAB from C++ and return the MATLAB output in a structure to C++. The structure could contain any number of things, including arrays of different dimensions and lengths. There's a similar question here, but the answer doesn't…
James
  • 99
  • 6
2
votes
1 answer

MX Create double matrix error when integrating matlab with VC++

When i create a project to pass a path of an image to my matlab project and i created the initialization: #include "feautresPoints.h" int main(int argc, char* argv[]) { mxArray* result; mxArray* x; double myArray[5]={10.2, 3, 6.3, 5.4,…
Amr Ramadan
  • 1,259
  • 5
  • 18
  • 29
2
votes
1 answer

MATLAB Engine Windows 7 problem

I am trying to figure how to use the Matlab engine so I can use C++ GUI with matlab function however I am having some trouble trying to figure out how to use the MATLAB engine classes. The first thing I did was try to run their examples after a bit…
Treesrule14
  • 711
  • 7
  • 14
2
votes
0 answers

Matlab Engine API OpenSingleUseFunction() and OpenEngineFunction() timeouts in 2 minutes

When I launch the Matlab tool in Windows machine, the tool launches but it is in "Initializing" phase for 4-5 minutes. The tool will not respond to any user commands. The issue could be due to usage of remote license. The usage of remote license or…
user13519327
2
votes
1 answer

Computing mean of Python numeric vector in MATLAB

I am trying to compute the mean of a Python numeric vector in MATLAB. To clarify, I am using Python but am trying to rely on some MATLAB-specific functions by running MATLAB in a Python environment. I am using matlab.engine to do this: ##### (From…
2
votes
1 answer

How to pass a dict as argument in a called matlab function from Python

I'm making a soft that call matlab functions, and i want to pass a dict as argument in a matlab function using matlab.engine in python. Like this: def Parametrize(confFile): """ Return Argument: confFile -- str() Configuration…
PAYRE Quentin
  • 341
  • 1
  • 12
2
votes
2 answers

AttributeError: module 'matlab' has no attribute 'engine'

I am running matlab engine from python, and it is giving an error on the line that imports matlab.engine saying that there is no module called named "matlab.engine", and that matlab is not a package. But when I try to import just matlab, it gives me…
syi
  • 85
  • 1
  • 2
  • 9
2
votes
2 answers

Matlab engine function in C returns zero

I was wondering if anyone could help me understand the syntax of Matlab engine in C. I am a beginner in C and am trying to call a custom Matlab function in C using Matlab Engine. Research that I have done includes reading the documentation for…
Lee
  • 33
  • 3
2
votes
1 answer

How to call a matlab function file from python using the matlab engine API?

I have a matlab function file called 'calculate_K_matrix.m ' which contains the following code: function K = calculate_K_matrix(A, B, n) K = place(A, B, eigs(A)*n) end I can call this from matlab like…
SomeRandomPhysicist
  • 1,531
  • 4
  • 19
  • 42
2
votes
1 answer

save() command in matlab engine for python

I am using MATLAB Engine API for Python https://nl.mathworks.com/help/matlab/matlab-engine-for-python.html I would like to open and save a file. #import and start the engine import matlab.engine eng = matlab.engine.start_matlab() print('Matlab…
00__00__00
  • 4,834
  • 9
  • 41
  • 89