Re: Python from Matlab (Piotr Majdak )


Subject: Re: Python from Matlab
From:    Piotr Majdak  <piotr@xxxxxxxx>
Date:    Fri, 22 Aug 2014 19:11:48 +0200
List-Archive:<http://lists.mcgill.ca/scripts/wa.exe?LIST=AUDITORY>

This is a multi-part message in MIME format. --------------030506050809010507020700 Content-Type: multipart/alternative; boundary="------------080508050209050305050500" --------------080508050209050305050500 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Dear Alain, There is the Matlab command "system", which you could use to call python=20 scripts like that: system('python MyPythonScript.py'); We use that in the Auditory Modeling Toolbox=20 <http://amtoolbox.sourceforge.net/> for Matlab, where we call the python=20 implementation of the cochlear model of Sarah Verhulst et al. As for passing parameters between Matlab and python, we have an ugly=20 solution only: we save Matlab variables in a mat file which are then=20 read from the python script. In order to get the results back to Matlab,=20 we use text files. While this is not an optimal way of passing=20 parameters (maybe the upcoming Matlab version will reduce that pain, as=20 Stephan already mentioned), at least it works for us at the moment. Maybe that helps you. Best regards, Piotr Alain de Cheveigne wrote: > Hi Marek, > > I am looking for the opposite: an easy, efficient and reliable way to = call Python from Matlab. My programming environment nowdays is matlab an= d I can't easily change. The best course that I see is to implement new = code in Python and call it from matlab, and make the switch to Python whe= n Python code reaches critical mass. I suspect many people are in a simi= lar position. > > Alain > --=20 Piotr Majdak Psychoakustik und Experimentelle Audiologie Institut f=FCr Schallforschung <http://www.kfs.oeaw.ac.at> =D6sterreichische Akademie der Wissenschaften <http://www.oeaw.ac.at/> Wohllebengasse 12-14, 1040 Wien Tel.: +43 1 51581-2511 Fax: +43 1 51581-2530 --------------080508050209050305050500 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <html> <head> <meta content=3D"text/html; charset=3DISO-8859-1" http-equiv=3D"Content-Type"> </head> <body bgcolor=3D"#FFFFFF" text=3D"#000000"> <div class=3D"moz-cite-prefix">Dear Alain,<br> <br> There is the Matlab command "system", which you could use to call python scripts like that: system('python MyPythonScript.py'); <br> <br> We use that in the <a href=3D"http://amtoolbox.sourceforge.net/">Au= ditory Modeling Toolbox</a> for Matlab, where we call the python implementation of the cochlear model of Sarah Verhulst et al. <br> <br> As for passing parameters between Matlab and python, we have an ugly solution only: we save Matlab variables in a mat file which are then read from the python script. In order to get the results back to Matlab, we use text files. While this is not an optimal way of passing parameters (maybe the upcoming Matlab version will reduce that pain, as Stephan already mentioned), at least it works for us at the moment. <br> <br> Maybe that helps you. <br> <br> Best regards,<br> Piotr <br> <br> Alain de Cheveigne wrote:<br> </div> <blockquote cite=3D"mid:3123_1408693958_53F6F6C6_3123_142_4_B8DCD180-766B-431F-A36F-8= 9B74B0FA1A3@xxxxxxxx" type=3D"cite"> <pre wrap=3D"">Hi Marek,=20 I am looking for the opposite: an easy, efficient and reliable way to ca= ll Python from Matlab. My programming environment nowdays is matlab and = I can't easily change. The best course that I see is to implement new co= de in Python and call it from matlab, and make the switch to Python when = Python code reaches critical mass. I suspect many people are in a simila= r position. Alain </pre> </blockquote> <br> <div class=3D"moz-signature">-- <br> Piotr Majdak<br> Psychoakustik und Experimentelle Audiologie<br> <a href=3D"http://www.kfs.oeaw.ac.at">Institut f=FCr Schallforschun= g</a><br> <a href=3D"http://www.oeaw.ac.at/">=D6sterreichische Akademie der Wissenschaften</a><br> Wohllebengasse 12-14, 1040 Wien<br> Tel.: +43 1 51581-2511<br> Fax: +43 1 51581-2530</div> </body> </html> --------------080508050209050305050500-- --------------030506050809010507020700 Content-Type: text/x-vcard; charset=utf-8; name="piotr.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="piotr.vcf" begin:vcard fn:Piotr Majdak n:Majdak;Piotr org;quoted-printable;quoted-printable:=C3=96sterreichische Akademie der Wissenschaften;Institut f=C3=BCr Schallforschung adr;quoted-printable:;;Wohllebengasse 12-14;Wien;;1040;=C3=96sterreich email;internet:piotr@xxxxxxxx tel;work:+43-1-51581-2511 tel;fax:+43-1-51581-2530 tel;home:+43-1-2938-480 tel;cell:+43-699-8133-5070 url:www.kfs.oeaw.ac.at version:2.1 end:vcard --------------030506050809010507020700--


This message came from the mail archive
http://www.auditory.org/postings/2014/
maintained by:
DAn Ellis <dpwe@ee.columbia.edu>
Electrical Engineering Dept., Columbia University