bastibe / transplant

Transplant is an easy way of calling Matlab from Python
https://transplant.readthedocs.io
Other
110 stars 26 forks source link

added a parameter "addpath" for Matlab() #95

Closed granthe2761 closed 3 years ago

granthe2761 commented 3 years ago

A parameter "addpath" was added to the Matlab() function to facilitate the settings of Matlab's path.

With this parameter, the Matlab files that always hide in the python project (Django, Tornado, etc.) can be added into the Matlab's path easily. Otherwise, we need to dig into the source code and add paths manually.

granthe2761 commented 3 years ago

Commonly, it seems that it is not necessary to add paths through Transplant because we can add paths through Matlab GUI.

Especially in Docker, however, adding paths through Matlab GUI is complicated thus I think this feature is necessary.

granthe2761 commented 3 years ago

Thank you very much for your review. It benefits me a lot.

I have a question. Did you mean that we can call matlab.addpath in python? Because I've tried and found that it was unuseful. If you mean that matlab.addpath can be called in a matlab file. Does it mean that we should create a .m file right beside the .py file to add path for matlab? If so, I sincerely hope this feature can be merged to 'transplant' since the current version will only add the path of the transplant when constructing. When I call matlab functions in a Python web project (especially when I call it from a Docker container), it is troublesome to add paths.

bastibe commented 3 years ago

But back to the question about addpath.

You should be able to call matlab.addpath() from Python (assuming you have a transplant-Matlab running in the variable matlab), and this should behave just like calling addpath from within Matlab. Is this not the case?