Import Matlab Engine

Hi all,

I would like to import Matlab engine to Rhino Python Editor. I have connected Matlab and Python on my computer using the Mathworks recomendations and it works in original Python shell, but not in Rhino Python Editor. When I run the standard “import matlab.engine” command it gives an error: No module named matlab.engine

Everything: Rhino, Matlab and Python are installed in their original directories.

What should I do to make it work ?

Thanks

Hi Peter,

It is not clear to me that Matlab works with IronPython, which is what Rhino uses. You might spend some time ‘googling’ this to see what you come up with.

That said, you might try adding the path to Matlab to the Python editor’s search path (Tools > Options).

– Dale

Hi Dale,

thanks for reply. I have been googling in the meantime and found out that you are right. IronPython and .pyd files (in which Matlab engine is defined) are not compatible. Well, connecting such a big systems as Rhino and Matlab are may be a nice ‘to do’ topic for the future.

Peter

If you don’t mind doing some extra work you could write with CPython a server app that defines a protocol through which you could communicate with your matlab engine. In Rhino you’d have a client that would connect with that server app. Quite a bit of indirection, and suboptimal, but at least it would let you work on your project.

1 Like