From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: babel, matlab export plot to png fails Date: Sun, 13 Aug 2017 14:30:41 +0000 Message-ID: References: <87shgveujl.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="f403045f50deb975ac0556a364ab" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dgtut-0004Bh-DN for emacs-orgmode@gnu.org; Sun, 13 Aug 2017 10:31:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dgtuq-0000QF-6a for emacs-orgmode@gnu.org; Sun, 13 Aug 2017 10:30:59 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:37754) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dgtup-0000P3-WE for emacs-orgmode@gnu.org; Sun, 13 Aug 2017 10:30:56 -0400 Received: by mail-wr0-f172.google.com with SMTP id 33so27181114wrz.4 for ; Sun, 13 Aug 2017 07:30:54 -0700 (PDT) In-Reply-To: <87shgveujl.fsf@mat.ucm.es> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --f403045f50deb975ac0556a364ab Content-Type: text/plain; charset="UTF-8" You need to get the contents of the png to get output. Maybe the type command will do that. E.g. Add as the last line: type testplot.png On Sun, Aug 13, 2017 at 1:34 AM Uwe Brauer wrote: > > Hi > > I would like to execute some matlab code in org file (using GNU emacs 26 > and the git version of org mode) and save the result of the plot command > in a png file, so I tried > > #+begin_src matlab :session :exports both :file testplot.png > t=[0:0.1:1]; > y=sin(t); > plot(t,y) > print -dpng testplot.png > #+end_src > > And also > #+begin_src matlab :results output latex :exports results :file > testplot.png > t=[0:0.1:1]; > y=sin(t); > plot(t,y) > print -dpng testplot.png > #+end_src > > But the resulting png files are corrupt. I presume also the matlab > commands are included in the png file which is not correct. But I don't > know who to achieve that just the last command is saved in a png file. > > I googled without success. Does somebody know the correct syntax? > > Thanks > > Uwe Brauer > > > -- John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu --f403045f50deb975ac0556a364ab Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You need to get the contents of the png to get outpu= t. Maybe the type command will do that. E.g. Add as the last line:

type testplot.png


On Sun, Aug 13, 201= 7 at 1:34 AM Uwe Brauer <oub@mat.ucm.e= s> wrote:

Hi

I would like to execute some matlab code in org file (using GNU emacs 26 and the git version of org mode) and save the result of the plot command in a png file, so I tried

#+begin_src matlab :session :exports both :file testplot.png
t=3D[0:0.1:1];
y=3Dsin(t);
plot(t,y)
print -dpng=C2=A0 testplot.png
#+end_src

And also
#+begin_src matlab :results output latex :exports results=C2=A0 :file testp= lot.png
t=3D[0:0.1:1];
y=3Dsin(t);
plot(t,y)
print -dpng=C2=A0 testplot.png
#+end_src

But the resulting png files are corrupt. I presume also the matlab
commands are included in the png file which is not correct. But I don't=
know who to achieve that just the last command is saved in a png file.

I googled without success. Does somebody know the correct syntax?

Thanks

Uwe Brauer


--
John

-----------------------------------
Professor John= Kitchin=C2=A0
Doherty Hall A207F
Department of Chemical Engineering<= br>Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
=
--f403045f50deb975ac0556a364ab--