Calling Python from Matlab

Carl phleum_nospam at chello.se
Sun Apr 16 06:20:31 EDT 2006


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 <mtobis at 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




More information about the Python-list mailing list