Snehal Patil
Snehal Patil

Reputation: 71

Calling Matlab function from python

I have one project in which I have one one matlab code which I have to run tho' Django. I tried installing Mlabwrap ..But it gives me following error.

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "mlabwrap.py", line 188, in <module>
import mlabraw
ImportError: No module named mlabraw

I also tried ompc (http://ompc.juricap.com/) but after addpath...it gives me a error...

Traceback (most recent call last):                                
File "<stdin>", line 1, in <module>                              
File "C:\Python27\lib\ihooks.py", line 407, in import_module       
q, tail = self.find_head_package(parent, str(name))            
File "C:\Python27\lib\ihooks.py", line 479, in find_head_packag    
raise ImportError, "No module named '%s'" % qname            
ImportError: No module named 'addpath'                           

Upvotes: 7

Views: 1912

Answers (2)

Alex Oulton
Alex Oulton

Reputation: 209

Step 1:

Download the matlabwrap.py module from http://mlabwrap.sourceforge.net/

Step 2:

Copy the folder into your site packages folder ie. C:\Python26\Lib\site-packages

Step 3:

Using windows? go to start, and open cmd line by typing cmd enter

Step 4: navigate to the aforementioned site packages directory using cd C:\Python26\Lib\site-packages enter

step 5: type python setup.py install you should see the cmd iterate through the install process

step 6: re-open python and type import matlabwrap - it should import without problems now

Upvotes: 1

Visgean Skeloru
Visgean Skeloru

Reputation: 2263

I would suggest you to download those modules and put them separately into different folder. The you can use them in your django app like this:

#settings.py:
sys.path.append("/home/visgean/scripty/pymodules/") # django modules like django_filters

They are obvisously installed wrongly. You can reinstall them or download as I suggested... Anyway it would be nice to know how exactly you installed them...

Upvotes: 0

Related Questions