How to have matlab engine return value of variable in python
21 visualizaciones (últimos 30 días)
I currently use the following set of commands to load up a Matlab session in Python:
eng = matlab.engine.start_matlab("-desktop")
I have become familiar with a few commands using this engine such as
Following the same pattern, if I have a variable in matlab named:
I should like to call this variable directly using the engine and have its value return in a python compatible format. However, neither
works. For the first attempt I get the following output in my matlab session :
<matlab.engine.matlabengine.MatlabFunc at 0x113dde80>
Which is not very helpful.
Also, if I have a user-defined function already added to the matlab file path using addpath(), I should also like to call this function from python. If the function FunctionName can take in variable VariableName, then my intuition says that something like this:
should work. However it does not.
How can I 1) return the values of variables in my Python session directly from matlab (without using eng.eval) and 2) call user defined matlab functions and pass in user defined variables (again without utilizing eng.eval)??