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
0
votes
0 answers

Import numpy in matlab

I'm working with python in matlab and I'm trying to import numpy but I can't. First I created an env in conda: conda create -n matlab python=3.7 numpy Then I set it in matlab prompt: pyversion('C:\Users\Familia\.conda\envs\matlab\python.exe') >>…
JCV
  • 447
  • 1
  • 5
  • 15
0
votes
1 answer

Convert numpy int to matlab int

I'm calling a matlab function in python through matlab engine, and I'm having problems to pass the variables. I have figured out how to pass some, but for this on I'm getting an error. should be a scalar int. but when I pass it I got the…
JCV
  • 447
  • 1
  • 5
  • 15
0
votes
1 answer

passing numpy array to matlab engine

I have a code in python but now I have to call a function developed for another person in Matlab. I would like to do that with matlab engine, but I have an error when passing the variables to the function, I got: TypeError: unsupported Python data…
JCV
  • 447
  • 1
  • 5
  • 15
0
votes
0 answers

Input arguments for MATLAB Engine function

I'm trying to use MATLAB engine to call a MATLAB function in Python, but I'm having some problems. After manage to deal with NumPy arrays as input in the function, now I have some error from MATLAB: MatlabExecutionError: Undefined function…
JCV
  • 447
  • 1
  • 5
  • 15
0
votes
1 answer

Can't import os.system and matlab.engine at the same time in the header

I want to start a shared matlab session then connect to it right away in the same python 3 script. I also want to keep my matlab session opened after the script finishes. Because in the future, I want to write a class to do this, I would like to…
tamashika
  • 25
  • 5
0
votes
1 answer

How to include "matlabengine.hpp" and "MatlabDataArray.hpp" files in gcc's search path on windows using 64-bits MinGW and 32-bits Matlab?

I have a file named call_mat.cpp with two statements at its beginning: \#include "MatlabDataArray.hpp" and \#include "MatlabEngine.hpp" These headers files are not on "gcc" default search path. They are in the folder…
0
votes
2 answers

Installing matlab for python

I'm trying to install matlab engine for python but doesn't work, I'm doing that from command line and doesn't display anything. These are my steps: I have add python tho my environment path than I found matlabroot and I get in with cd in command…
JCV
  • 447
  • 1
  • 5
  • 15
0
votes
1 answer

Python 3.6 <-> Python 3.4 intercommunication

There is a bit of Matlab code id like to automate with an existing Python Project (through their supplied API which only runs on python v3.4 for my particular Matlab version). The Project im trying to build it into uses python 3.6. Is there a way in…
Vlad
  • 1
  • 3
0
votes
1 answer

Using a Matlab user function in Python gives an error

I have user Matlab function. It is written by someone else. There are multiple functions in that file but the first function that has the same name as the .m file itsel is the one that I try to call. It gets 4 arguments (string, string, string,…
Payam30
  • 689
  • 1
  • 5
  • 20
0
votes
1 answer

Converting all MatLab workspace variables to Python variables

I am working on running a MatLab script (.m) on Python like this (idea from here): import matlab.engine eng = matlab.engine.start_matlab() eng.testing(nargout=0) test = eng.workspace['M'] print(type(test)) print(test) This is working, it will…
FFLS
  • 565
  • 1
  • 4
  • 19
0
votes
1 answer

Calling MATLAB from a DLL File

I know this has been posted before but none of the answers work for me. I'm using VISSIM v10 and made a DLL File to make an external driver model. This is working well. But what I want is to implement the algorithms in MATLAB instead and make the…
0
votes
1 answer

Run Matlab script from Python: TypeError: 'float' object is not iterable

Actually I have a problem when calling a Matlab script from Python. import matlab.engine import os import random import numpy as np a=[str(random.randint(1,3)) for _ in…
Thang Ha
  • 21
  • 1
  • 2
0
votes
0 answers

How to get user input into MatLab script called from Python script

I am calling a MatLab script from a python script and my MatLab script requires user input. When I am prompted for input the terminal doesn't allow input. Am I able to get user input into the MatLab function when I run the function from python? How…
SPYBUG96
  • 1,089
  • 5
  • 20
  • 38
0
votes
0 answers

Java's MatlabEngine can't access my function

I'm trying to call my matlab void function (which I created) from Java with MatlabEngine like this: eng.feval("my_funtion",param1,param2,param3); However, I always get this error: Undefined function or variable 'my_funtion'. I thought that the…
LPepe
  • 3
  • 1
0
votes
1 answer

Issue using mathworks engine API for java on Mac

I'm trying to use the Mathworks MATLAB Engine API for Java on my Macbook Pro. By following this guide on the mathworks website I have added the /extern/engines/java/jar/engine.jar to the classpath, and I've also used a tcsh shell to add /bin/maci64…
D. Sill
  • 277
  • 1
  • 9