473,414 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Calling Python from Matlab

I am desperately looking for a way to call Python from Matlab. I have become
used to Python's rich syntax and large number of libraries, and feel
ridiculously clumsy being stuck with Matlab's rather restricted facilities
for doing other things than standard mathematical work.

Does anyone know of good techniques (or readily available software) for
achieving a cross-language support between Python and Matlab?

Carl
Apr 15 '06 #1
9 5271
> I am desperately looking for a way to call Python from Matlab. I have become
used to Python's rich syntax and large number of libraries, and feel
ridiculously clumsy being stuck with Matlab's rather restricted facilities
for doing other things than standard mathematical work.

Does anyone know of good techniques (or readily available software) for
achieving a cross-language support between Python and Matlab?

Carl


Perhaps you will find this useful:

http://claymore.engineer.gvsu.edu/~s...hon/pymat.html
Apr 15 '06 #2
I'm afraid I can't be very helpful to you, but you could be most
helpful to some of us.

Can you elaborate on what specifically you found difficult? In some
circles Python is regarded as a direct competitor to Matlab. Your
preference for Python for "other things than standard mathematical
work" in a scientific or engineering context could be most useful if
you have some real-world examples.

Also, can you elaborate on what (if anything) it is about Matlab that
you feel you can't replicate in Python? Are you aware of matplotlib and
numpy?

thanks
mt

Apr 15 '06 #3
I have a suspicion it is the collaborative effort that is the problem
here -- I try to use Python whenever possible for
engineering/numerical analysis, but the established industry standard
(for most disciplines of engineering) is still MATLAB.

Although Python is arguably better in most respects, especially being
a full-blown programming language (and modules such as SciPy and NumPy
are just great), but it's hard to expect your co-workers to be using
Python for analysis also.

On 15 Apr 2006 16:00:08 -0700, Michael Tobis <mt****@gmail.com> wrote:
I'm afraid I can't be very helpful to you, but you could be most
helpful to some of us.

Can you elaborate on what specifically you found difficult? In some
circles Python is regarded as a direct competitor to Matlab. Your
preference for Python for "other things than standard mathematical
work" in a scientific or engineering context could be most useful if
you have some real-world examples.

Also, can you elaborate on what (if anything) it is about Matlab that
you feel you can't replicate in Python? Are you aware of matplotlib and
numpy?

thanks
mt

--
http://mail.python.org/mailman/listinfo/python-list

Apr 15 '06 #4
Kelvie Wong wrote:
I have a suspicion it is the collaborative effort that is the problem
here -- I try to use Python whenever possible for
engineering/numerical analysis, but the established industry standard
(for most disciplines of engineering) is still MATLAB.

Although Python is arguably better in most respects, especially being
a full-blown programming language (and modules such as SciPy and NumPy
are just great), but it's hard to expect your co-workers to be using
Python for analysis also.

On 15 Apr 2006 16:00:08 -0700, Michael Tobis <mt****@gmail.com> wrote:
I'm afraid I can't be very helpful to you, but you could be most
helpful to some of us.

Can you elaborate on what specifically you found difficult? In some
circles Python is regarded as a direct competitor to Matlab. Your
preference for Python for "other things than standard mathematical
work" in a scientific or engineering context could be most useful if
you have some real-world examples.

Also, can you elaborate on what (if anything) it is about Matlab that
you feel you can't replicate in Python? Are you aware of matplotlib and
numpy?

thanks
mt

--
http://mail.python.org/mailman/listinfo/python-list

This is exactly my problem!

I have to use Matlab at work because it is the language my fellow co-workers
use. At my previous work we used Python as our language of choice. I never
had had to use Matlab because Numeric, numarray, SciPy, etc were already
there. These libraries worked beautifully with Python!

My major problem with Matlab is not the language; it is a quite nice
language, comparable to Python and R. The problem is the lack of libraries
for doing things that are not basic mathematical stuff, such as reading
text from files, handling strings, pickling, etc. When you are used to
Python's large number of high-quality modules you feel disadvantaged being
confined to using only Matlab.

I have learnt that Matlab provides a facility for executing Perl commands
and running Perl scripts, but I have not used it yet. It would have been
nice to have the possibility of mixing Matlab and Python code, by using
inlining, for example!

One option could be to use Perl to call Python from within Matlab.

Carl

Apr 16 '06 #5
I've been a Matlab user for years and have recently started using
Python with matplotlib and NumPy for most of my work. The only thing I
found that is still lacking is a 3D capability in matplotlib. I was
trying to visualize a hill climbing algorithm and I couldn't find
anything comparable to Matlab's 'surface', 'mesh', or 'plot3'. I think
VTK would have done the trick but there's only so much time in the
day...

Apr 16 '06 #6
In article <2Po0g.9446$zc1.6404@amstwist00>,
Carl <ph***********@chello.se> wrote:
My major problem with Matlab is not the language; it is a quite nice
language, comparable to Python and R.


Having done a bunch of MATLAB GUI programming for a client a few years
ago, I would not agree that MATLAB is a "nice" language at all. The
basic matrix stuff is fine, but all the structure stuff had a definite
feling of being tacked on. The GUI stuff in particular was very fiddly
to do.
Apr 16 '06 #7
>>>>> "AgenteSegreto" == AgenteSegreto <na********@gmail.com> writes:

AgenteSegreto> I've been a Matlab user for years and have recently
AgenteSegreto> started using Python with matplotlib and NumPy for
AgenteSegreto> most of my work. The only thing I found that is
AgenteSegreto> still lacking is a 3D capability in matplotlib. I

There is some progress being made on this front -- in svn are a
collection of classes for basic 3d plots (plot3, mesh, surf) but the
interface to these is still under development. We hope they will be
included in the next major release 0.88.

You can see some examples here:

http://www.scipy.org/Wiki/Cookbook/Matplotlib/mplot3D

Also, there is a master's student who will be working on extending mpl
3d capabilities as part of her master's project, so expect some basic
functionality in the near future.

We certainly don't aim to compete with VTK or other full-blown 3D
solutions like Mayavi

http://mayavi.sourceforge.net/
http://www.enthought.com/enthought/wiki/MayaVi
http://www.scipy.org/ArndBaecker/MayaVi2

but most agree it would be nice to have some support for basic 3D
plotting in matplotlib.

JDH
Apr 17 '06 #8
"Daniel Nogradi" <no*****@gmail.com> writes:
I am desperately looking for a way to call Python from Matlab. I have become
used to Python's rich syntax and large number of libraries, and feel
ridiculously clumsy being stuck with Matlab's rather restricted facilities
for doing other things than standard mathematical work.

Does anyone know of good techniques (or readily available software) for
achieving a cross-language support between Python and Matlab?

Carl


Perhaps you will find this useful:

http://claymore.engineer.gvsu.edu/~s...hon/pymat.html


I'd recommend looking at

<http://mlabwrap.sourceforge.net/>

instead (but then I'm the author). It's based on pymat but contains several
critical bugfixes and a high-level interface from python to matlab (e.g. you
can just do mlab.plot([1,2,3]) or x = mlab.sin(3)). I'll need to update a
couple of things, but on the whole it appears quite stable -- people have
succefully used it under windows, linux and os x.

'as

Apr 23 '06 #9
Also, can you elaborate on what (if anything) it is about Matlab that
you feel you can't replicate in Python? Are you aware of matplotlib and
numpy?


The features provided by some matlab 'toolboxes' (libraries in
matlab-speak)
are lacking, and are beyond what numpy + scipy may provide. Some
projects
done in Matlab could easily be translated to Python, but probably not
the control
engineering kind for example -- the algorithms provided by the control
toolbox,
the identification toolbox, etc. are standard tools in the field, and
were
implemented by domain experts.

Don't get me wrong. There are A LOT of scientific projects that can be
done
with Python, and I'd rather cut my hand than do some Matlab programming
when I can avoid it.

I also believe that the work involved in the proper installation of
numpy +
scipy + matplotlib is far beyond the average Matlab user ability (check
the
amount of "installation problem" on the numpy mailing-list ...). But
for sure,
the work done in these libs is just great and their community is
extremely
reactive and helpful.

Last thought: the "All Python behavior in the presence of infinities,
NaNs, and
signed zeroes is a platform-dependent accident" meme still worries me
from
time to time ... But, hey, that's probably just me :)

Cheers,

S.B.

Apr 23 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Paul McGuire | last post by:
I've spent the past day or so working through the various complexities in calling Matlab routines from Python (please do not reply with suggestions to use Numpy/Scipy/etc. - our customer is using...
4
by: dataangel | last post by:
I'm a student who's considering doing a project for a Machine Learning class on pathing (bots learning to run through a maze). The language primarily used by the class has been Matlab. I would...
19
by: Nicolas Pernetty | last post by:
Hello, I'm looking for any work/paper/ressource about continuous system simulation using Python or any similar object oriented languages (or even UML theory !). I'm aware of SimPy for...
3
by: Mohammed Smadi | last post by:
Hi; Does anyone know if we can call matlab for a python or bash script while feeding the matlab script some command line arguments? I have an interactive matlab script which i want to automate...
53
by: Michael Tobis | last post by:
Someone asked me to write a brief essay regarding the value-add proposition for Python in the Fortran community. Slightly modified to remove a few climatology-related specifics, here it is. I...
8
by: Allen | last post by:
Does anyone agree with me? If you have used Matlab, welcome to discuss it.
4
by: wang frank | last post by:
Hi, While comparing the speed of octave and matlab, I decided to do a similar test for python and matlab. The result shows that python is slower than matlab by a factor of 5. It is not bad since...
4
by: itcecsa | last post by:
Hi, I am implementing a small Python project, what I am going to do is to open Matlab and run some M-files, and get some output from Matlab command prompt. I have no idea how to open Matlab...
0
by: rperera | last post by:
1. I want to call a matlab function that my colleague did in Matlab from Python E.g >>matlab.DetermineOutputValues(text,ArrayOfValues) My input is text, and ArrayOfValues is the value...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.