Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65536 > unrolled thread
| Started by | Sam <cuongpn@gmail.com> |
|---|---|
| First post | 2014-02-06 05:30 -0800 |
| Last post | 2014-02-08 22:30 -0800 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.python
python and matlab Sam <cuongpn@gmail.com> - 2014-02-06 05:30 -0800
Re: python and matlab Sturla Molden <sturla.molden@gmail.com> - 2014-02-06 13:55 +0000
Re: python and matlab Sam Adams <cuongpn@gmail.com> - 2014-02-06 06:18 -0800
Re: python and matlab Sturla Molden <sturla.molden@gmail.com> - 2014-02-07 05:28 +0000
Re: python and matlab Rustom Mody <rustompmody@gmail.com> - 2014-02-06 22:06 -0800
Re: python and matlab Sturla Molden <sturla.molden@gmail.com> - 2014-02-07 11:07 +0000
Re: python and matlab pavlovevidence@gmail.com - 2014-02-08 22:30 -0800
| From | Sam <cuongpn@gmail.com> |
|---|---|
| Date | 2014-02-06 05:30 -0800 |
| Subject | python and matlab |
| Message-ID | <df066d92-bb6b-4ba8-af03-571ecfaa60ce@googlegroups.com> |
is it able to utilize functions written in Python in Matlab?
[toc] | [next] | [standalone]
| From | Sturla Molden <sturla.molden@gmail.com> |
|---|---|
| Date | 2014-02-06 13:55 +0000 |
| Message-ID | <mailman.6445.1391695206.18130.python-list@python.org> |
| In reply to | #65536 |
Sam <cuongpn@gmail.com> wrote: > is it able to utilize functions written in Python in Matlab? Yes, if you embed the Python interpreter in a MEX-file.
[toc] | [prev] | [next] | [standalone]
| From | Sam Adams <cuongpn@gmail.com> |
|---|---|
| Date | 2014-02-06 06:18 -0800 |
| Message-ID | <239c6022-9c8d-48d4-8ddf-cae552ab1e3d@googlegroups.com> |
| In reply to | #65538 |
On Thursday, February 6, 2014 8:55:09 AM UTC-5, Sturla Molden wrote: > Sam <cuo...@gmail.com> wrote: > > > is it able to utilize functions written in Python in Matlab? > > > > Yes, if you embed the Python interpreter in a MEX-file. Thanks Sturla, could you please explain in more details, I am new to Python :)
[toc] | [prev] | [next] | [standalone]
| From | Sturla Molden <sturla.molden@gmail.com> |
|---|---|
| Date | 2014-02-07 05:28 +0000 |
| Message-ID | <mailman.6484.1391750931.18130.python-list@python.org> |
| In reply to | #65541 |
Sam Adams <cuongpn@gmail.com> wrote:
> Thanks Sturla, could you please explain in more details, I am new to Python :)
All the information you need to extend or embed Python is in the docs.
Apart from that, why do you need Matlab? A distro like Enthought Canopy or
Anaconda has all the tools you will ever need for scientific programming.
Embedding Python is almost never the right solution to a problem. But if
you really need Matlab, you will be far better off by calling Matlab engine
from Python (e.g. using ctypes or Cython).
There are also packages like mlab and matlabwrap that will help you embed
Matlab in Python:
https://pypi.python.org/pypi/mlab
http://mlabwrap.sourceforge.net
Apart from that, you can also invoke Python from Matlab like this:
arg1 = 'script.py';
s = system(sprintf('python %s', arg1));
or
arg1 = 'some Python code';
s = system(sprintf('python -c "%s"', arg1));
Or if you are on Windows, you can use pywin32 to create an ActiveX server
with Python, and invoke that from Matlab.
Sturla
[toc] | [prev] | [next] | [standalone]
| From | Rustom Mody <rustompmody@gmail.com> |
|---|---|
| Date | 2014-02-06 22:06 -0800 |
| Message-ID | <413fb74f-ea38-44e9-b898-dae888af1866@googlegroups.com> |
| In reply to | #65597 |
On Friday, February 7, 2014 10:58:26 AM UTC+5:30, Sturla Molden wrote: > Sam Adams wrote: > > Thanks Sturla, could you please explain in more details, I am new to Python :) > All the information you need to extend or embed Python is in the docs. > Apart from that, why do you need Matlab? A distro like Enthought Canopy or > Anaconda has all the tools you will ever need for scientific programming. > Embedding Python is almost never the right solution to a problem. But if > you really need Matlab, you will be far better off by calling Matlab engine > from Python (e.g. using ctypes or Cython). Dont know the software involved so only some general comments When you connect two disparate pieces of significant software there is inherently an impedance mismatch. What Sturla is probably saying is that the matmab-python imp-mismatch is so high that jumping across is almost certainly not worth the trouble. And BTW have you seen sage? http://www.sagemath.org/
[toc] | [prev] | [next] | [standalone]
| From | Sturla Molden <sturla.molden@gmail.com> |
|---|---|
| Date | 2014-02-07 11:07 +0000 |
| Message-ID | <mailman.6495.1391771251.18130.python-list@python.org> |
| In reply to | #65600 |
Rustom Mody <rustompmody@gmail.com> wrote: > What Sturla is probably saying is that the matmab-python imp-mismatch is > so high that jumping across is almost certainly not worth the trouble. I am saying that the abundance of Python packages for numerical and scientific computing (NumPy et al.) and their quality is now so good that binding Python to Matlab is not worth the effort. The only reason to do this would be if Matlab is needed for a very special reason. E.g. there might be a toolbox only available for Matlab, or there might be an administrative decision to use Matlab albeit a Python package is needed. But if it is just a general feeling that Python lacks the tools needed for numerical computing, then it is a false assumption and not worth it. Note that hardly any of the tools used for numerical computing with Python is in the standard library. They are all focused around NumPy as the central package. See scipy.org for further information. > And BTW have you seen sage? > http://www.sagemath.org/ Sage is supposed to be a computer algebra system, i.e. a free alternative to Maple or Mathematica. Matlab is not a CAS system but a scripting environment for numerical computing. Enthought Canopy and Anaconda are similar environments based on Python. enthought.com continuum.io While they require a payed license, it is also possible to hand-pick the needed packages and install them ourselves. But for libraries like NumPy to be liked against high-performance libraries like Intel MKL, we must build them ourselves or use one of the commercial Python distros for scientific computing. Sturla
[toc] | [prev] | [next] | [standalone]
| From | pavlovevidence@gmail.com |
|---|---|
| Date | 2014-02-08 22:30 -0800 |
| Message-ID | <ceff8857-177d-4473-8a1b-0145ecbee666@googlegroups.com> |
| In reply to | #65536 |
On Thursday, February 6, 2014 5:30:54 AM UTC-8, Sam Adams wrote: > is it able to utilize functions written in Python in Matlab? If it's on Windows, and if it's pure-Python 2.x code, the easiest solution would be to use Iron Python or Jython. Matlab can call Java and .NET code natively.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web