Calling Matlab function from python

2024/10/3 14:23:59

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'                           
Answer

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

https://en.xdnf.cn/q/70717.html

Related Q&A

Suds ignoring proxy setting

Im trying to use the salesforce-python-toolkit to make web services calls to the Salesforce API, however Im having trouble getting the client to go through a proxy. Since the toolkit is based on top of…

CSV to JSON script

I took this script from here: import csv from itertools import izip f = open( /django/sw2/wkw2/csvtest1.csv, r ) reader = csv.reader( f ) keys = ( "firm_url", "firm_name", "fir…

Accessing an ALREADY running process, with Python

Question: Is there a way, using Python, to access the stdout of a running process? This process has not been started by Python.Context: There is a program called mayabatch, that renders out images fro…

sum up two pandas dataframes with different indexes element by element

I have two pandas dataframes, say df1 and df2, of some size each but with different indexes and I would like to sum up the two dataframes element by element. I provide you an easy example to better und…

Urwid: make cursor invisible

Im using urwid, which is a Python "framework" for designing terminal user interfaces in ncurses. Theres one thing though that Im not able to do in urwid that was easy in curses - make the cur…

How do I use scipy.weave.inline together with external C libraries?

I am trying to understand weave.inline to wrap C code in my Python programs. The code below simply takes the Numpy array and multiplicates all of its elements by 2.inl.py import numpy import scipy.weav…

sqlalchemy multiple foreign keys to same table

I have a postgres database that looks something like this:Table "public.entities"Column | Type | Modifiers ---------------+---…

Django - Return a file from Root folder via a URL

I purchased a SSL cert online and now ind the mid of verifying my host. How it works is:It gives me a file I have to make that file accessible through a specific URL on my host. If the content of the f…

Flask deployement on lighttpd and raspberry pi

Im trying to deploy a hello flask app to a raspberry pi using lighttpd fastCGI.I followed the instructions on the http://flask.pocoo.org/docs/0.10/deploying/fastcgi/ to the best of my abilityHere is my…

Django admin asks for login after every click

Im working on a Django app hosted on Heroku. Im able to login to the admin with my username, password. But on every single click (or on each click after a few seconds) it redirects me to the login page…