4

I have a few matlab scripts. I want to call them in python. Is something possible like this?

I know a little matlab but very new to python and trying to understand how to work with it.

I have a test.py and I also have a function written in matlab. I want to obtain the result from matlab and also use that result in python.

I don't know how to do that. I looked at some examples here but didn't understand them could somebody please explain how to do that?

Thank you so much!

Semih Yagcioglu
  • 4,011
  • 1
  • 26
  • 43

1 Answers1

4

You can call MATLAB functions as well as user scripts from within Python easily. Parameter passing is also possible. Assuming you have a function with 3 parameters x,y,z.

Try this:

import matlab.engine
eng = matlab.engine.start_matlab()
x, y, z = 3, 5, 8
r = eng.compute(x, y, z)
Semih Yagcioglu
  • 4,011
  • 1
  • 26
  • 43