Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'                           
like image 491
Snehal Patil Avatar asked Oct 29 '11 01:10

Snehal Patil


1 Answers

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

like image 162
Alex Oulton Avatar answered Oct 04 '22 05:10

Alex Oulton